y=@(x) ((x+1)^2)*(exp(x^2-2)-1);a=0; b=1;m=(a+b)/2;while abs(y(m))<0.01 disp(m) if y(a)*y(m)<0 b=m;elseif y(b)*y(m)<0 a=m; end end
~~~~~
i want to find m<0.01?
what am i doing wrong?
embedded matlab functionMATLABmatlab codernumerical analysis
y=@(x) ((x+1)^2)*(exp(x^2-2)-1);a=0; b=1;m=(a+b)/2;while abs(y(m))<0.01 disp(m) if y(a)*y(m)<0 b=m;elseif y(b)*y(m)<0 a=m; end end
Best Answer