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 (최근 30일)
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개)

카테고리

Help CenterFile Exchange에서 RF Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by