Borrar filtros
Borrar filtros

exp(-x) - sinx = 0

3 visualizaciones (últimos 30 días)
reza
reza el 10 de En. de 2014
Editada: Youssef Khmou el 11 de En. de 2014
hi, i'm planning to reach the root of this function:
exp(-x) - sinx = 0;
here is my code:
------------------------------
x0 = input('please enter x0 ::: ');
eps = input('please enter steps ::: ');
% eps is the step
iterator = 0;
for i=0:eps:x0
x=x+exp(-x) - sin(x);
iterator = iteratio + 1;
end
disp('root ::: '); disp(x);
disp('iterate count ::: '); disp(iterator);
------------------------------
well i can't make it work. can you help me with that?

Respuestas (2)

Mischa Kim
Mischa Kim el 10 de En. de 2014
Try the fzero function. Unless, of course, you would like to do it on your own.

reza
reza el 10 de En. de 2014
Now it's working,
x0 = input('please enter x0 ::: '); eps = input('please enter steps ::: '); iterator = 0; x=0; iterator = 0; for i=0:eps:x0 x=x+exp(-x) - sin(x); iterator = iterator + 1; end disp('root ::: '); disp(x); disp('iterate count ::: '); disp(iterator);
thanks to all.
  6 comentarios
Mischa Kim
Mischa Kim el 11 de En. de 2014
By solutions you mean roots? Here is the function plot:
Youssef  Khmou
Youssef Khmou el 11 de En. de 2014
Editada: Youssef Khmou el 11 de En. de 2014
alright, infinite number of solutions with period of ~3.1
thanks

Iniciar sesión para comentar.

Categorías

Más información sobre Linear Programming and Mixed-Integer Linear Programming en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by