fminsearch to fit data

2 visualizaciones (últimos 30 días)
MOH
MOH el 28 de Oct. de 2021
Comentada: MOH el 28 de Oct. de 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)

Respuesta aceptada

Walter Roberson
Walter Roberson el 28 de Oct. de 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.

Más respuestas (0)

Categorías

Más información sobre Nonlinear Optimization en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by