What does this error message mean?
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
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);
0 comentarios
Respuestas (3)
Sean de Wolski
el 3 de Oct. de 2014
For some reason the model is returning an imaginary component. I would contact tech support, that error message is useless.
Matt J
el 3 de Oct. de 2014
Editada: Matt J
el 3 de Oct. de 2014
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.
Star Strider
el 3 de Oct. de 2014
Editada: Star Strider
el 3 de Oct. de 2014
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.
0 comentarios
Ver también
Categorías
Más información sobre Interpolation en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!