fminsearch to fit data

1 vue (au cours des 30 derniers jours)
MOH
MOH le 28 Oct 2021
Commenté : MOH le 28 Oct 2021
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)

Réponse acceptée

Walter Roberson
Walter Roberson le 28 Oct 2021
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 commentaire
MOH
MOH le 28 Oct 2021
thank you

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Nonlinear Optimization dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by