MATLAB Answers

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

7 views (last 30 days)
Brian Gtz
Brian Gtz on 9 Feb 2020
Answered: Star Strider on 9 Feb 2020
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

  0 Comments

Sign in to comment.

Answers (1)

Star Strider
Star Strider on 9 Feb 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;

  0 Comments

Sign in to comment.

Sign in to answer this question.

Products


Translated by