i want to display my answer in table format with heading for the numerical method .the following is the code .but it does diaplay in proper table
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
f= inline('x^3-2*x-5','x') a=input('enter the lower value='); b=input('enter the upper value='); fa=feval(f,a);% to evalulate the value of function at a fb=feval(f,b); %n=6
while(fa*fb>0)% while loop will run until and unless the expression is false a=input('enter the lower value='); b=input('enter the upper value='); fa=feval(f,a); fb=feval(f,b); end for i=1:1:50 c=(a+b)/2; fc=feval(f,c); e=0.001; error=abs(b-a); t=[ i a fa b fb c fc e] % disp('i a fa b fb c fc e') % disp[(i,a , fa , b, fb ,c , fc, e)] % fprintf('Table of iteration, a,fa,b,fb,c,fc') % fprintf('i a fa b fb c fc')
if (abs(fc)<0.001)
disp(c);
break;
elseif (abs(b-a)<e)
disp(c);
break;
elseif( fa*fc<0)
b=c;
fb=fc;
else
a=c;
fa=fc;
end
end
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu RF Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!