Question: I have two matrices x and y, both are results from different algorithms/routines that are supposed to calculate the same result. While I know that the isequal() would check if x and y are the same matrix, the entries in those matrices would not be exactly the same (i.e. some entries may be with 5% off in worst case scenario). In this scenario, what would be the best method of comparing them to see if they are close enough to be considered the same result? Thanks in advance for the advices.

Answer: 
When you have very small value pairs in x and y, the result would return 0 although the values are ignorable themselves. So, an addition to the accepted solution

```
relError(x < absTol) = 0;
```

might be used to discard very small errors. Thus, the relative error is not considered for these values.
make use of 'isequal(a,b) where a and b are two matrices, if 1 it is true