How to set bounds for coefficents when fitting a second order Exponential?
8 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I am trying to fit a second order exponential to a standard set of experimental mechanical creep data. See below.
[creep_data_fit, gof] = fit(time , distance, 'exp2');
I have data that goes out to 3 hours but when I plot and fit data less than that the fit deviates towards infinity (theoretical fit for creep data) instead of to a steady state (experimental fit for creep data). The format of the fit is below.
Y = a*exp(b*x)+c*exp(d*x)
The function is fitting positive coefficients for a and b and negative coefficients for c and d. However, if the fit used negative coefficients for a, b, c, and d it would more closely approximate my experimental data.
Is there a way to give a negative range of proposed values for the coefficients?
Or is there a better way to "force" the fit to my data?
0 comentarios
Respuestas (2)
Tom Lane
el 18 de Abr. de 2013
Type "help fit" and you'll see the fourth input can be a fitoptions structure. Then type "help fitoptions" and you'll see you can create one doing something like this, specifying lower and upper bounds for four coefficients:
fo = fitoptions('exp2','lower',[1 2 3 4],'upper',[2 4 6 8])
Maybe Matt's idea is better, but this shows how to use "fit" to do it.
3 comentarios
Harold Bell
el 18 de Oct. de 2013
Could you please comment on how to decide good upper and lower bounds? Everyone says "according to your data." But how to actually decide? Isn't it cheating in a way if you make it too narrow?
Matt J
el 18 de Oct. de 2013
Isn't it cheating in a way if you make it too narrow?
I wouldn't say it's cheating. It just might lead to a very poor fit.
The choice of the bounds should be derived from modeling insights, i.e., from prior information you have about the process that generated the data. If your prior information doesn't give a clue to that, then maybe you shouldn't use bounds.
Matt J
el 17 de Abr. de 2013
Editada: Matt J
el 17 de Abr. de 2013
LSQCURVEFIT, if you have it, let's you impose bound constraints. However, you would probably want to re-parametrize the curve something like the following, so that the two exponential terms can be distinguished.
Y = a*exp(b*x)+c*exp((b+d^2)*x)
This ensures that the second exponential term always has a slower decay than the first term. Even better would be
Y = a*exp(b*x)+c*exp((b+d^2+q)*x)
if you know some minimum amount q>0 by which the decay rates should differ
Ver también
Categorías
Más información sobre Interpolation en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!