How do I find all the positive roots of (e^(-.2x ))(cos(2x))-.15x^2+1
3 次查看(过去 30 天)
显示 更早的评论
So far, I've done
fun=@(x) exp^(-.2*x)*cos(2*x)-.15*x^(2)+1;
x0=[-6: .1 :6];
z=fzero(fun,x0);
Nothing happens.
0 个评论
回答(1 个)
Seth DeLand
2013-4-10
2 things: 1) fzero is designed to find a single zero at a time. You will need to loop through each value for x0 and record the zero the fzero found for that starting point. Something like:
for i = 1:length(x0)
z(i) = fzero(fun, x0(i));
end
2) exp is a function that expects 1 input, if you want to calculate e^(-.2x) you can write:
exp(-.2*x)
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Get Started with Optimization Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!