필터 지우기
필터 지우기

How to set bounds for coefficents when fitting a second order Exponential?

조회 수: 16 (최근 30일)
Alison
Alison 2013년 4월 17일
댓글: Matt J 2013년 10월 18일
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?

답변 (2개)

Tom Lane
Tom Lane 2013년 4월 18일
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
Harold Bell
Harold Bell 2013년 10월 18일
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
Matt J 2013년 10월 18일
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
Matt J 2013년 4월 17일
편집: Matt J 2013년 4월 17일
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

카테고리

Help CenterFile Exchange에서 Get Started with Curve Fitting Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by