Curve Fit fixed at bounds problem

Hello,
I have been having problems trying to fit the following function to my given data:
sqrt(a).*(2 .* b .* exp(-b .* x)) + sqrt(1-a) * (.204124145*(D).^(5/2)* x *exp((-D)*x*(1/2)))
The data in use was generated using the following function, with x values from 0 to 10 with 0.1 steps:
y=-.047833878*exp((-18.7311370)*(x + .7199811451).^2)+ -.081134269*exp((-2.8253937)*(x + .7199811451).^2) + -.092369697*exp((-.6401217)*(x + .7199811451).^2) + -.148487297*exp((-.1612778)*(x + .7199811451).^2)+ (.011189936*x + .008056543) .* exp((-1.1)*(x + .7199811451).^2)+ .047833878*exp((-18.7311370)*(x - .7199811451).^2)+ .081134269*exp((-2.8253937)*(x - .7199811451).^2) + .092369697*exp((-.6401217)*(x - .7199811451).^2) + .148487297*exp((-.1612778)*(x - .7199811451).^2)+ (.011189936*x - .008056543) .* exp((-1.1)*(x - .7199811451).^2).
Then using Curve Fitting Tool, I have tried to fit the generated data to this function:
sqrt(a).*(2 .* b .* exp(-b .* x)) + sqrt(1-a) * (.204124145*(D).^(5/2)* x *exp((-D)*x*(1/2)))
Note that a has a range between 0 and 1, b has a range between 0 and 5, and D has a range also between 0 and 5.
When I finally tried to perform the non-linear least squares fit, I keep on receiving the following problem:
General model:
f(x) = sqrt(a).*(2 .* b .* exp(-b .* x)) + sqrt(1-a) * (.204124145*(D).^(5/2)
* x *exp((-D)*x*(1/2)))
Coefficients (with 95% confidence bounds):
D = 2.22e-14 (fixed at bound)
a = 0.08913 (0.08806, 0.0902)
b = 0.7275 (0.7214, 0.7337)
Goodness of fit:
SSE: 0.01507
R-square: 0.9928
Adjusted R-square: 0.9927
RMSE: 0.0055
Is there anyway that I can remove this fixed at bounds error? Thank you for your time.

 Respuesta aceptada

Walter Roberson
Walter Roberson el 11 de Abr. de 2016

1 voto

Yes, you could change the lower bound for D to be -inf. It appears to me that "fixed at bound" means that it has been driven as small as you permitted in your lb and tolerances together.

1 comentario

Sarabjeet  Seehra
Sarabjeet Seehra el 11 de Abr. de 2016
Thank you for your help. Unfortunately, I am now getting the following error with your suggestion: Complex value computed by model function, fitting cannot continue. Try using or tightening upper and lower bounds on coefficients.
And when I try to tighten the upper and lower bounds, I get the same error as before

Iniciar sesión para comentar.

Más respuestas (1)

Leo Polak
Leo Polak el 14 de En. de 2023
Editada: Leo Polak el 14 de En. de 2023

0 votos

I think this result means that, although the fit result D is within range, the confidence interval is out of range. With more data or another fitting procedure you might be able to solve this. But if D is very close to a bound and the data doesn't determine the parameter accurately that might impossible. Probably, you could just set D to zero and that wouldn't change your fit significantly.

3 comentarios

Walter Roberson
Walter Roberson el 14 de En. de 2023
I think this result means that, although the fit result D is within range, the confidence interval is out of range.
No, it means that no matter how small (positive) that you make D, you can get a smaller residue if you use a smaller (positive) D. That does not mean the confidence interval is out of range.
fit() does not even notice if the confidence interval reported for a variable extends outside of the range of the upper and lower bounds you established for the variable. The confidence interval reported is based on mean and standard deviation of the recorded values, projected to a particular certainty (for example two standard deviations.)
Probably, you could just set D to zero
Yes, as far as the model fit can tell, D could be 0.
Leo Polak
Leo Polak el 22 de Feb. de 2023
Thanks!
No, it means that no matter how small (positive) that you make D, you can get a smaller residue if you use a smaller (positive) D. That does not mean the confidence interval is out of range.
But, doesn't that mean that zero is the best fitting value? Why does it give this specific value, is that the best fitting value? And why is it not giving a confidence interval with it, is that not possible?
I actually have a similar situation, but when I set that fitparameter to zero I get a slightly poorer fit, the rsquare is bit lower, rmse is a bit higher, etc., which seems to contradict the idea that zero is the best fitting value and suggests that there is a non zero positive value that is the best fit.
We can deduce from the message that when the original poster used the Curve Fitting Toolbox, that they used options to set the lower limit for D to
format long g
100*eps
ans =
2.22044604925031e-14
and fit() did not go lower than that for D because a particular bound was requested.
It is not giving a confidence bound because all of its jacobian estimates say that D should go smaller than the bound the user requested. It cannot properly estimate the "correct" value for D because the calculations all say "smaller than the user permits".

Iniciar sesión para comentar.

Preguntada:

el 10 de Abr. de 2016

Comentada:

el 22 de Feb. de 2023

Community Treasure Hunt

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

Start Hunting!

Translated by