I try to write code to do Bisection method after get input from user, but I'm stuck right now. Basically, after the WHILE statement, I put multiple conditions in order but matlab doesn't work. This is my code:
if true
c2=input('what is the coefficient for x^2');
c1=input('what is the coefficient for x');
c0=input('What is the last coefficient');
a=input('What is value for a');
b=input('what is value for b');
c=0.5*(a+b);
value=c2*(c^2)+c1*c+c0
while value>=1e-6
(a>0 && c>0) || (a<0 && c<0);
a==c
else b==c
end
I stuck at the WHILE LOOP. I want after I get the "value", matlab will check "value">=1e-6. If that's true, it will set a=c if a and c same sign, otherwise it will set b=c. Then run the equation: value=c2*(c^2)+c1*c+c0 again with update a or b depend on condition until the "value"<1e-6.
Thanks