필터 지우기
필터 지우기

How to apply least square approach in this case?

조회 수: 1 (최근 30일)
Zine
Zine 2016년 2월 2일
편집: Walter Roberson 2016년 2월 2일
I think I have a connected problem, it is given to me the experimental data (xdata,ydata), and I am asked to fit them to a model to find the parameters (a,b,c,d) with a model function as follows:
Y=f(xdata, A,B,C,D) with
A = fun1(xdata,a,b,c,d)
B = fun2(xdata,a,b,c,d)
C = fun3(xdata,a,b,c,d)
if xdata < d
D = fun4(xdata,a,b,c,d)
elseif xdaat> d
D = fun5(xdata,a,b,c,d)
end
with fun4 is totally different from fun5, so how to formulate the problem in this case please
  댓글 수: 2
Walter Roberson
Walter Roberson 2016년 2월 2일
In some of those cases your f has 5 parameters, in some it has 4 parameters, in some it has 3 parameters, and in some it has 1 parameter. Those cannot all be the same function.
Zine
Zine 2016년 2월 2일
편집: Zine 2016년 2월 2일
Thanks Walter for your passing, you are right, I edited the question to be more clear, the idea is one of the parameters is a criteria to choose the objective function

댓글을 달려면 로그인하십시오.

채택된 답변

Walter Roberson
Walter Roberson 2016년 2월 2일
편집: Walter Roberson 2016년 2월 2일
The objective function for the minimizers can have if/else clauses. You would minimize over a, b, c, d, pass xdata in as an additional parameter, calculate your A, B, C, D, and use those to calculate f.
However, any time you have an if/else, or a min() or max(), you run the risk that you are introducing a discontinuity in the objective function or its first derivative, and either of those will typically lead to incorrect results for all of the minimizers for fmincon and all of the other minimizers in the Optimization Toolbox. As well, some of the minimizers for fmincon might have problems if the second derivative is not continuous.
If your objective or uts first derivative are not continuous then you need to use a function from the Global Optimization toolbox, or you need to split the inputs into subranges each of which has a continuous first derivative, run those separately, and take the best of the results.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Problem-Based Optimization Setup에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by