Hi All,
I want to find positive root x of this function;
x^10=1;
I wrote a program using modified false postion algorythm but i don't know how to use it to solve equation written above. Here is the Code;
function ModFalsePos=eqn(xl,xu,es,xr,ea)f=@(x)x^10-1xl=0xu=1.3es=0.01fl=f(xl)fu=f(xu)while (1) xr=xu-fu*(xl-xu)/(fl-fu) xrold=xr fr=f(xr) if xr<0 elseif xr>0 ea=abs((xr-xold)/xr)*100 end test=fl*fr if test<0 xu=xr fu=f(xu) iu=0 il=il+1 if il>=2 fl=fl/2 end elseif test>0 xl=xr fl=f(xl) il=0 iu=iu+1 if iu>=2 fu=fu/2 end else ea=0 end if ea<es break endendModFalsePos=xrend
Could anyone please help me for solving this equation using this code? What's wrong here?
Thanks for any Help!
Best Answer