I am trying to make a table with the outputs of for loop!
Afficher commentaires plus anciens
format long
close all
clear all
clc
xu=10;
xl=0;
xrpv=0;
er=0;
f=@(x)(5*exp(0.5*x)+10-x^3.5);
for i=1:1:200;
xr=(xl+xu)/2;
fxr=f(xr);
er=((xr-xrpv)/xr)*100;
xrpv=xr;
if (f(xl)*f(xr)>0)
xl=xr;
else
xu=xr;
end
if abs(er)<10^-6
disp(abs(er));
break
end
end
table like;
i xl xr xu fxr er
1 0 5 10 -208.596 100
2 ** *** * *** ** **
3 ** *** ** ** ** **
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Loops and Conditional Statements dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!