exp(-x) - sinx = 0; _ MATLAB [英] exp(-x) - sinx = 0; _ MATLAB

查看:327
本文介绍了exp(-x) - sinx = 0; _ MATLAB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我打算到达这个功能的根源:



exp(-x) - sinx = 0 ;



这是我的代码:



------------ ------------------



x0 =输入('请输入x0 :::');



eps =输入('请输入步骤:::');



%eps是步骤



iterator = 0;



for i = 0:eps:x0



x = x + exp(-x) - sin(x);



iterator = iteratio + 1;



结束



disp('root :::');

disp(x) ;



disp('iterate count :::');

disp(迭代器);

< br $>
------------------------------



我不能使它工作。你可以帮我吗?


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?

推荐答案

我强烈建议首先得到图表的感觉。

1)sin( x)周期性地在2⋅π并且每个n⋅π具有根(∀n∈N 0

2)sin(x)≈x(x远小于π/ 2)

3)e -x 将monotoinc变为零(∀x∈R,x≥0)

4)e < sup> -x 的样本值为:e 0 = 1,e ≈0.0432,e -2⋅π ≈0.0019,e -3⋅π≈0.00008,e -4⋅π≈0.0000034,...



从这里,你可以假设e -x - sin(x)的根是



  • ≈n⋅π(∀n∈N)(因为e -x 对于值x =π及以上可以忽略)
  • ≈0.59(对于0和π之间的根) )(通过设置e -x ≈x并估计并粗略计算π/ 6和π/ 4之间的某个值)
I strongly suggest to first get a "feeling" for the graph.
1) sin(x) is periodically in 2⋅π and has roots every n⋅π (∀ n ∈ Ν0)
2) sin(x) ≈ x (x much smaller than π/2)
3) e-x goes monotoinc to zero (∀ x ∈ R, x ≥ 0)
4) e-x has sample values at: e0 = 1, e ≈ 0.0432, e-2⋅π ≈ 0.0019, e-3⋅π ≈ 0.00008, e-4⋅π ≈ 0.0000034, ...

From this, you can postulate that the roots for e-x - sin(x) are

  • ≈ n⋅π (∀ n ∈ Ν) (since e-x for values x=π and above can be neglected)
  • ≈ 0.59 (for the root between 0 and π) (found by setting e-x ≈ x and estimating and roughly calculating some value between π/6 and π/4)


现在它正在工作,



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.


这篇关于exp(-x) - sinx = 0; _ MATLAB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆