You are trying to access an array element that does not exist. Basically you have something like this:
>> X = [1,2,3]
>> X(4)
Index exceeds matrix dimensions.
Of course this causes an error, because there is no fourth element in X.
However it could be that there is some confusion with the variable taylorexp: although you define it as a variable on this line
taylorexp(order,iterations)=y;
perhaps you thought that that calls your taylorexp function?
I would recommend that you do not give functions and variables the same name (or use the names of any MATLAB functions). If it is supposed to be a function call, what do you imagine that
taylorexp(order,iterations)=y;
should do?
Best Answer