fminsearch to fit data

1 回表示 (過去 30 日間)
MOH
MOH 2021 年 10 月 28 日
コメント済み: MOH 2021 年 10 月 28 日
how I can pass two varibales and 2 euqations to fit using fminsearch
fminsearch(@(a,c) opt(a,c,x,y),[1,1])
I'm getting below error
>> fminsearch(@(a,c) opt(a,c,x,y),[1,1])
Not enough input arguments.
Error in @(a,c)opt(a,c,x,y)

採用された回答

Walter Roberson
Walter Roberson 2021 年 10 月 28 日
You cannot pass two variables and two equations to fit to fminsearch()
fminsearch() can work with a vector of variables, but only with one equation.
Your example only shows one function being passed to fminsearch() . You can handle the pair of variables like this:
fminsearch(@(ac) opt(ac(1), ac(2), x, y), [1, 1])
opt() will be responsible for returning a scalar value.
  1 件のコメント
MOH
MOH 2021 年 10 月 28 日
thank you

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

その他の回答 (0 件)

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by