Using solve function to find the roots
12 次查看(过去 30 天)
显示 更早的评论
syms x
y = 2*x*exp(-x)-sin(x)==0;
d=solve(y,x)
It gives the "zero" as the only value that makes the y zero. But the roots should be 0.8030 and 2.7923 (I have looked from ezplot). Why can't I find the roots with the solve function?
0 个评论
采纳的回答
Walter Roberson
2016-1-18
solve() can only find all solutions for polynomials. For non-linear functions, it will give a warning and find one numeric solution.
Since you need to switch to numeric solutions anyhow, use vpasolve() with initial guesses to select the range to find the solution over. vpasolve() will only find one solution at a time, but it will allow you to select the range to look in.
3 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Number Theory 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!