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 CenterFile Exchange에서 Nonlinear Optimization에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by