フィルターのクリア

Find minimum of single-variable function

3 ビュー (過去 30 日間)
Mark S
Mark S 2021 年 1 月 25 日
コメント済み: Adam Danz 2021 年 1 月 26 日
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
Adam Danz 2021 年 1 月 25 日
Sounds like homework.
The documentation should be helpful to understand what that function is doing,
Mark S
Mark S 2021 年 1 月 25 日
編集済み: Mark S 2021 年 1 月 25 日
Thank you for your help. I have answered a) in my exam, it would be nice if you can say if it's right or not. Because also with the link that you have mentioned i am not sure if my answer was right or not :/

サインインしてコメントする。

回答 (1 件)

Adam Danz
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 件のコメント
Mark S
Mark S 2021 年 1 月 25 日
編集済み: Mark S 2021 年 1 月 25 日
Ok, for x i get 4.5994e-05 and for fval =-1.0000
I put x into a) f(x)=1-sin4.5994e-05^2=1
I put x into b) f(x)=1-sin^2 *4.5994e-05=1
I get for same 1. But I think this cant't be right...
Adam Danz
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 ExchangeProgramming についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by