Find minimum of single-variable function
1 次查看(过去 30 天)
显示 更早的评论
Hi, what expression is calculated by the following command in Matlab?
Code:
fminbnd(@(x) (sin(x).^2-1),0,pi)
Minimum of:
(a) f(x)=1-sin x^2 or (b)1-sin^2x.
I answered a) in my exercise, however I am not sure if this is correct. Can someone tell me if this is correct?
2 个评论
Adam Danz
2021-1-25
Sounds like homework.
The documentation should be helpful to understand what that function is doing,
回答(1 个)
Adam Danz
2021-1-25
Hint:
[x,fval] = fminbnd(___)
gives you the (x,y) values at the minimum.
You could plug the x values into both of your options and the one that returns the matching y value is the correct function.
2 个评论
Adam Danz
2021-1-26
Could you share the 2 lines of code where you tested the two versions? There's probably an error in how you're setting the equations.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!