How to make a iteration table for while loof (Solving equations in one variable: false position method)

1 view (last 30 days)
Hello
I want to make a iteration table for c In this while loof
How can I make a code? It is for solving equations in one variable: false position method
I want to know about convergenc history(table)
x = linspace(-0.5,5,501);
y = -2*exp(x./2) + 10;
a = 2.5;
b = 4;
e = 1*10^-6;
fa = -2*exp(a./2) + 10;
fb = -2*exp(b./2) + 10;
while true
c = (a*fb - b*fa)./(fb - fa); %false position
fc = -2*exp(c./2) + 10;
if fa*fc < 0
b = c;
fb =-2*exp(b./2) + 10;
else
a = c;
fa = -2*exp(a./2) + 10;
end
if abs(fc) < e
break;
end
disp(c);

Answers (0)

Categories

Find more on Numeric Types in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!