modified newton's method

10 visualizaciones (últimos 30 días)
Robin
Robin el 30 de Nov. de 2011
I am new to matlab. How do apply a formula to an equation? EX. formula: x(sub n)=x(sub n-1) - m (f(xsub n-1)/ f'(xsub n-1) to eqn f(x) = x^3 -3x^2 + 4 = 0

Respuestas (1)

bym
bym el 1 de Dic. de 2011
one way is to use anonymous functions:
f = @(x) x^3-3*x^2+4;
fprime = @(x) 3*x^2-6*x;
then use a for loop to perform the iteration
x = zeros(10,1);
x(1)=.1
for i = 1:9
x(i+1) = x(i)-f(x(i))./fprime(x(i));
end

Categorías

Más información sobre Problem-Based Optimization Setup en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by