You will get an error in this code.
f = fcnchk(funfcn);
c = (a + b)/2;
The values of a and b are not defined or provided as an input. This can only work, if you have M-files called a.m and b.m, but this would be a very bad choice of names.
1. the expression for w?
w = [s .242611071901408 fliplr(s)];
What exactly is your question concerning this line? w is defined as a row vector, which contains the elements of s, the value 0.242... (the leading zero can be omitted, but it is recommended to avoid this for clarity) and finally the elements of s in reversed order. See help fliplr.
r = abs(Q2-Q0)/abs(Q1-Q0+realmin(class(Q0)));
2. the expression for Q0?
Q0 is h times w times the transposed of y. When w and y are vectors, this is the dot product.
3. the term realmin(class(Q0))?
Did you read the documentation already?
The smallest possible number of the class of Q0 is created, e.g. 2.2251e-308 if Q0 is a double. This avoid the division by 0 if Q1 and Q0 have exactly the same value. But this can still fail, when Q1 equals Q0+realmin. Better:
(abs(Q1 - Q0) + realmin(class(Q0))
This is still extremely large and the result is dominated by random rounding errors. Therefore I'd prefer to get a NaN from a division by zero, such that the problem is clear.
Best Answer