Find the approximate positive solution of the following equation
By the split method, the error should not exceed 0.002.

 Respuesta aceptada

Alan Stevens
Alan Stevens el 8 de Nov. de 2020

0 votos

A little more like this perhaps (note the way the function, f, is defined):
f = @(x) x.^3- 0.2*x.^2 - 0.2*x - 1.2;
a0=1;
b0=2;
max_iterate = 0.002;
i=0 ;
format short e
a = a0; b = b0;
c = (a+b)/2;
while b-c > max_iterate
i=i+1;
fb = f(b);
fc = f(c);
if sign(fb)*sign(fc) <= 0
a = c; fa = fc;
else
b = c; fb = fc;
end
c = (a+b)/2;
iteration = [i a b c fc b-c];
disp(iteration)
end

Más respuestas (0)

Categorías

Más información sobre Numerical Integration and Differential Equations en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 8 de Nov. de 2020

Editada:

el 8 de Nov. de 2020

Community Treasure Hunt

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

Start Hunting!

Translated by