ticsyms x y;f(x) = (2.*x-1).*sin(pi.*x);for i=1:25 y(i)=diff(f(x),i);endfun=matlabFunction(y');x=-2:0.01:1;result=fun(x);maxres = max(result,[],2)for i=1:25 if maxres(i)<0.001 break end end
someone can tell me the way to find max y(i) = diff (f(x),i) in every step and check it
if max(y(i))< 0.001 then stop the loop
Best Answer