필터 지우기
필터 지우기

What does this error message mean?

조회 수: 11 (최근 30일)
Matthias
Matthias 2014년 10월 3일
편집: Matt J 2014년 10월 6일
I've got two vectors:
times =
0 0.0005 0.0050 0.0500 0.5000 5.0000
mittel =
0 2.0505 5.7940 8.8363 14.1563 35.6821
I would like to fit two functions to these vectors:
func1 = 'y ~ b0*(x + b1)^(1/2)';
fitresult = NonLinearModel.fit(times,mittel,func1,[ 2.775e+06 0.008033 ]);
and
func2 = 'y ~ b0*(x + b1)^(1/3)';
fitresult2 = NonLinearModel.fit(times,mittel,func2,[2.1e+01 0 ]);
The first works absolutly fine, but the second gives me an error I don't understand:
Error using internal.stats.getscheffeparam>ValidateParameters (line 182)
If non-empty, JW must be a numeric, real matrix.
Error in internal.stats.getscheffeparam (line 110)
[J,VF,VP,JW,Intopt,TolSVD,TolE,VQ,usingJ] =
ValidateParameters(J,VF,VP,JW,Intopt,TolSVD,TolE,VQ,allowedIntopt);
Error in nlinfit (line 340)
sch =
internal.stats.getscheffeparam('WeightedJacobian',J(~nans,:),'Intopt','observation','VQ',VQ);
Error in NonLinearModel/fitter (line 1121)
[model.Coefs,~,J_r,model.CoefficientCovariance,model.MSE,model.ErrorModelInfo,~]
= ...
Error in classreg.regr.FitObject/doFit (line 219)
model = fitter(model);
Error in NonLinearModel.fit (line 1484)
model = doFit(model);

답변 (3개)

Sean de Wolski
Sean de Wolski 2014년 10월 3일
For some reason the model is returning an imaginary component. I would contact tech support, that error message is useless.
  댓글 수: 2
Matt J
Matt J 2014년 10월 3일
편집: Matt J 2014년 10월 6일
Probably because (x+b1).^(1/3) is being used instead of nthroot(x+b1,3). E.g.,
>> (-1)^(1/3)
ans =
0.5000 + 0.8660i
>> nthroot(-1,3)
ans =
-1
Sean de Wolski
Sean de Wolski 2014년 10월 6일
Learn something new every day :)

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


Matt J
Matt J 2014년 10월 3일
편집: Matt J 2014년 10월 3일
In addition to the need for nthroot(q,3) instead of q^(1/3), your model equations are non-differentiable w.r.t. b1. This makes me wonder if the Jacobian calculations are creating trouble.
I recommend FMINSPLEAS ( Download ) for your problem, since it does not rely on differentiability. Also, it can take advantage of the fact your model is linear w.r.t. b0.
  댓글 수: 1
Matt J
Matt J 2014년 10월 3일
편집: Matt J 2014년 10월 3일
As an example
z=[times(:),ones(numel(times),1)]\mittel(:).^3;
b1start=z(2)./z(1); %starting guess for b1
[b1,b0]=fminspleas( {@(b1,x) nthroot(x + b1, 3)}, b1start, times, mittel)

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


Star Strider
Star Strider 2014년 10월 3일
편집: Star Strider 2014년 10월 3일
For whatever reason, nlinfit does not have a problem with either one:
func1 = @(b,x) b(1).*(x + b(2)).^(1/2);
func2 = @(b,x) b(1).*(x + b(2)).^(1/3);
B1 = nlinfit(times, mittel, func1, [ 2.775e+06 0.008033 ])
B2 = nlinfit(times, mittel, func2, [2.1e+01 0 ])
producing:
B1 =
16.2925e+000 47.9075e-003
B2 =
20.5786e+000 -850.3513e-021i 6.1977e-012 +156.4066e-024i
but it returns complex parameter estimates for ‘B2’, although with negligible imaginary components.

카테고리

Help CenterFile Exchange에서 Support Vector Machine Regression에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by