fminsearch with 3 variables

4 ビュー (過去 30 日間)
Jens Petit-jean
Jens Petit-jean 2021 年 2 月 28 日
コメント済み: Jens Petit-jean 2021 年 2 月 28 日
Hello,
How do I use fminsearch for a equation with 3 variables?
f(x,y,z)=1-(x-1)^(2) * (y-1.7)^(2) - (y-1.5)^(2) * (z-2.1)^2
I thought something like this :
fun=@(x,y,z) 1-(x-1).^(2).*(y-1.7)^(2)-(y-1.5)^(2)*(z-2.1).^2
fminsearch(fun,[0,0,3]) (with (0,0,3) a random point)
but I always got the message "Not enough input arguments"
Thanks in advance!

採用された回答

Walter Roberson
Walter Roberson 2021 年 2 月 28 日
example
f=@(v)v(1).*v(2)-sin(v(1)+v(2))
Instead of
f=@(x,y)x.*y-sin(x+y)
  1 件のコメント
Jens Petit-jean
Jens Petit-jean 2021 年 2 月 28 日
thanks!

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSolver Outputs and Iterative Display についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by