I think this is likely to be a function that you write yourself. I use three things pretty constantly to do computational vector tests, so to speak:
Maximum absolute error
return max(abs(result(:) - expected(:))) < tolerance
This calculates the maximum absolute point error and tells you that this is less than some tolerance.
Maximum number of errors when an error is exceeded
return sum( (abs(result(:) - expected(:))) < tolerance )
This returns the number of points out of range. It is also easy to change to return the percentage.
Square Squared Error
return norm(result(:) - expected(:)) < rmsTolerance
Since these and many other criteria exist for comparing arrays of floats, I would suggest writing a function that will take the result of the calculation, the expected result, the tolerance, and the comparison method. This way you can make your checks very compact, and it will be much less ugly than trying to explain what you are doing in the comments.
Phonon May 23 '14 at 8:51 2014-05-23 08:51
source share