I cannot detect an error on Newton Method.
2 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am programming the Newton Method, but I doesn´t work. Someone could help me. I would really appreciate it.
I also want to plot the function but it does not work either.
I did the following:
x = a:0.01:x+10
plot (x,f(x))
And it did not work, because no graphic appeared.
I attached the code.
0 comentarios
Respuesta aceptada
VBBV
el 6 de Abr. de 2023
function [x,n,error] = NewtonRaphson(f,a,eps_f,eps_x,df,maxits)
%>> df
% remaining code
x = a:0.01:x+10
plot (x,f(x))
end
Pass the anonymous function df into function NewtonRaphson
2 comentarios
VBBV
el 6 de Abr. de 2023
Editada: VBBV
el 6 de Abr. de 2023
Or you can plot it outside the function as below
[x,n,error] = NewtonRaphson(f,a,eps_f,eps_x,df,maxits)
x = a:0.01:x+10;
plot (x,f(x))
%--------------------------------------------------->> df as argument
function [x,n,error] = NewtonRaphson(f,a,eps_f,eps_x,df,maxits)
% code
end
Más respuestas (0)
Ver también
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!