Info

La pregunta está cerrada. Vuélvala a abrir para editarla o responderla.

Undefined operator '-' for input arguments of type 'function_handle'.

1 visualización (últimos 30 días)
Brian Gtz
Brian Gtz el 9 de Feb. de 2020
Cerrada: MATLAB Answer Bot el 20 de Ag. de 2021
me sale un error y no se como resolverlo
can you help me with my code, i have a error a idont know how to solve it
clc
funcioon=@(x) x.^2-x*100+1;
CI=1000;
delta=0.0001;
error=100;
n=0;
while error>0.00000001
funci=funcioon(CI);
funmasdel=funcioon(CI+delta);
derivada=(funmasdel-funci)/delta;
Xn=(CI-funcioon)/derivada
error=abs(funcioon(Xn))
CI=xn
n=n+1
if n>500000
break
end
end

Respuestas (1)

Star Strider
Star Strider el 9 de Feb. de 2020
You have to evaluate a function if you want to use it in a computation.
For example —
Xn=(CI-funci)/derivada;
would work.
Also, since MATLAB is case-sensitive, change this line to:
CI=Xn;

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by