Hello I'm taking Numerical Methods course in my college. And am trying to write a program for a method called 'bisection method' and this is my program :
clear; fx=inline('sin(0.01*x)+cos(0.75*x^2)'); xl=2; xu=2.5; n=5 % number of iteration xr_old; for i=1:n xr=(xl+xu)/2; ea=abs((xr - xr_old)/xr)*100; xr_old=xr; % To display the results: Type the following command % if i==1 dis('iteration Xl Xu Xr f(Xl)*f(Xu) ea'); end dis([i xl xu xr fx(xl)*fx(xu) ea]); if fx(xl)*fx(xr) < 0 xu=xr; else if fx(xl)*fx(xu) > 0 xl=xr; else return; end end end
When I want to run it, am keeping getting the following error:
??? Error: File: C:\MATLAB6p1\work\bisection.m Line: 6 Column: 7 Missing operator, comma, or semicolon.
So what is wrong with it?
No products are associated with this question.