필터 지우기
필터 지우기

Custom Fit Fit options

조회 수: 5 (최근 30일)
J.S.
J.S. 2018년 6월 22일
편집: Matt J 2018년 6월 25일
I have created a custom fittype and tried let MATLAB itself find the starting point, given lower and upper bounds that I specify. However, those bounds seem to have been ignored when the fit process was performed (see attachments). Does anyone know how I can force MATLAB to search for the coefficients between the bounds I have specified? Thank you.

답변 (1개)

Matt J
Matt J 2018년 6월 22일
편집: Matt J 2018년 6월 23일
The bounds weren't ignored. You defined them in "Options", but just forgot to pass Options to the fitting routine.
  댓글 수: 4
J.S.
J.S. 2018년 6월 25일
Sorry about that.
x0=0.6; y0=0.6;
HOF=fittype('a*exp(b*(x-x0))+c*exp(d*(x-x0))+y0','coefficients',{'a','b'...
'c','d'},'problem',{'x0','y0'},'independent','x');
L=[0,(-1/(0.1e-9)),0,(-1/(0.1e-9))];
U=[1,(-1/(1e-6)),1,(-1/(1e-6))];
Op=fitoptions(HOF);
Op.Lower=L;
Op.Upper=U;
f_normTEST=fit(binTimeCol,bindataColNorm,HOF,'problem',{x0,y0},Op);
binTimeCol and bindataColNorm are two column vectors of the same length.
Matt J
Matt J 2018년 6월 25일
편집: Matt J 2018년 6월 25일
Well, the problem is probably that you are now constraining b,d to a region where the exp() operations overflow to infinity, as in the following:
>> exp(1000)
ans =
Inf
You need to double-check the magnitudes of (x-x0) to be sure that range is sensible.
One other remark. I recommend reformulating the model as follows
U=[1,(-1/(1e-6)),1,-1];
HOF=fittype('a*exp(b*X)+c*exp((b+d)*X)',...
'coefficients',{'a','b','c','d'},'independent','X');
f_normTEST=fit(binTimeCol-x0,bindataColNorm-y0,HOF,Op);
There are 2 main changes. First, the input data is pre-offset by x0,y0 so that the fitting routine doesn't have to repeat it unnecessarily in every iteration. Second, one of the exponential parameters is now represented as b+d. This tells the solver that those parameters are meant to be nonequal, since that would make a,c ambiguous.

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

카테고리

Help CenterFile Exchange에서 Linear and Nonlinear Regression에 대해 자세히 알아보기

제품


릴리스

R2015b

Community Treasure Hunt

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

Start Hunting!

Translated by