フィルターのクリア

How to use fmincon for my function with 2 variables?

1 回表示 (過去 30 日間)
Sanjal C C
Sanjal C C 2018 年 6 月 23 日
編集済み: Walter Roberson 2018 年 6 月 24 日
function [pointoftangency] = Tangentpoint(X,Y,amplitude)
ptf=amplitude*sin(2*pi*x./25)+((2*pi*amplitude/25)*cos(2*pi*x./25)*(X-x))-Y
end
and my constraint equation is
amplitude*sin(2*pi*x/25)=0;
How do I solve this using fmincon??
  2 件のコメント
Rik
Rik 2018 年 6 月 24 日
Have a read here and here. It will greatly improve your chances of getting an answer.
You can 'trick' fmincon by entering your variables as a vector into your function.
Walter Roberson
Walter Roberson 2018 年 6 月 24 日
Which are the two variables? You have X, Y, and amplitude as inputs to Tangentpoint, and your code also uses x as well. Your code computs ptf, but your function expects pointoftangency to be output.
What is it that needs to be minimized?

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

回答 (1 件)

Walter Roberson
Walter Roberson 2018 年 6 月 24 日
編集済み: Walter Roberson 2018 年 6 月 24 日
Assuming that it is ptf that needs to be minimized with X, Y, amplitude constants, then the solution is that ptf becomes arbitrarily small (towards negative infinity) as x approaches positive infinity, assuming the value 2*Pi*amplitude*(X-50*Z)*(1/25)-Y when x = 50*Z with Z being an integer.
ptf becomes arbitrarily small (towards negative infinity) as x approaches negative infinity when x = 50*Z+25 with Z being an integer.

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by