Can you minimize a function in MATLAB?

The force is F=(mMg)/(cos(theta)+Msin(theta), and theta is between 0 and pi/2 I have the values for m, M and g but I need to find the angle that the force is the smallest. I also need to find the magnitude of the force. To find the angle where force is the smallest, do I need to minimize it? How would I go about doing that?

3 件のコメント

the cyclist
the cyclist 2015 年 4 月 29 日
Not related to your MATLAB question, but you might want to be careful with your force definition. It looks like you might have mismatched units in the denominator.
John D'Errico
John D'Errico 2015 年 4 月 29 日
編集済み: John D'Errico 2015 年 4 月 29 日
It depends on what M means. If M has units, then, yes, there is arguably a problem, because we would have
cos(theta) + M*sin(theta)
in an additive expression. That works only if M is unit-less.
But to be honest, it looks like M might be unit-less. My guess is m is a mass, g looks like an acceleration. Therefore m*g is a force, and we have no use for units on M.
the cyclist
the cyclist 2015 年 4 月 29 日
You are absolutely correct. I assumed that M is a large mass, and m a small mass.

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

回答 (2 件)

the cyclist
the cyclist 2015 年 4 月 29 日

1 投票

Yes, you can use the fminbnd function.
John D'Errico
John D'Errico 2015 年 4 月 29 日

1 投票

Use fminbnd. I'll show you how to define the function.
F = @(theta) (m*M*g)./(cos(theta)+M*sin(theta));

カテゴリ

ヘルプ センター および File ExchangeView and Analyze Simulation Results についてさらに検索

質問済み:

2015 年 4 月 29 日

コメント済み:

2015 年 4 月 29 日

Community Treasure Hunt

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

Start Hunting!

Translated by