Time constant of exponential decay

35 ビュー (過去 30 日間)
friet
friet 2018 年 3 月 2 日
コメント済み: John D'Errico 2018 年 3 月 3 日
Hello Matlab,
I have those two equations of exponential decay with time constant of the first one tu1=3800 sec. I plot those graphs and then from the graph, when I find the 36% decay of the initial value, I read different value tu2=5397. Can anyone help me what I am missing here?
y0=2;
tu1=3800;
tu2=1200;
t=0:1:10000;
y=y0*exp(-t/tu1)+ 0.4;
y2=(y0/2)*exp(-t/tu2)+0.5;
plot(t,y,t,y2)
legend('1','2')
  3 件のコメント
friet
friet 2018 年 3 月 2 日
In short my question is:
tu1=3800;
y=y0*exp(-t/tu1)+ 0.4;
I have ploted the above equation and when I calculate the time constant from the plot(i.e., 36% of the original value, (0.36*2.4=0.88)) the time is 5397 instead of 3800.
John D'Errico
John D'Errico 2018 年 3 月 2 日
What you are doing with that 36% point only makes sense if you have a PURE exponential decay. You don't.

サインインしてコメントする。

回答 (2 件)

John D'Errico
John D'Errico 2018 年 3 月 2 日
編集済み: John D'Errico 2018 年 3 月 2 日
As Walter pointed out, you don't have a purely exponential model. Yet, this is way easier than you think to solve. Two lines of code to recover the time constant. ;-)
Presume the model is a negative exponential, plus an unknown constant, sampled at an arithmetic sequence in t.
dt = t(2) - t(1);
dy = diff(y);
So assume the model was
y(t) = y0*exp(-t/tc) + yinf
Then when we used diff, it kills off the unknown additive constant. (i.e., the asymptote as t-->infinity.) We will get something like
y0*(exp(-(t + dt)/tc) - exp(-t/tc)) = y0*exp(-t/tc)*(1 - exp(-dt/tc))
Here, dt is quite small compared to tc, but both dt and tc are fixed, thus not a function of t. We don't know either y0 or tc, YET. Take the log.
log(diff(y)) = log(y0*(1-exp(-dt/tc))) - t/tc
Again, the first term is constant, thus not a function of t. While we don't know what that constant is, we don't care, as this part is targeted at solving for tc. The second term is linear in t.
We solve for tc using polyfit.
P1 = polyfit(t(2:end),log(-diff(y)),1)
P1 =
-0.00026316 -7.5495
tc = -1/P1(1)
tc =
3800
Yup. That looks familiar.
To recover the unknowns from the second series,
P2 = polyfit(t(2:end),log(-diff(y2)),1)
P2 =
-0.00083333 -7.0897
tc2 = -1/P2(1)
tc2 =
1200
Ok. That really was pretty easy. Can we now recover the constants y0 and the asymptote at infinity? Easy peasy too. Just one more line. Oddly enough, we use polyfit once more.
polyfit(exp(-t/tc),y,1)
ans =
2 0.4
For the second curve...
polyfit(exp(-t/tc2),y2,1)
ans =
1 0.5
I think you should recognize each of those coefficients for each dataset.
Such a versatile tool, that polyfit. We used it twice, fitting a straight line fit each time, yet we solved a nonlinear curve fitting problem, recovering not only the rate constant, but the asymptote at infinity as well as the multiplicative constant out front.
Kind of pretty. (Yes, I played a bit fast and loose with the statistics here.)
  5 件のコメント
John D'Errico
John D'Errico 2018 年 3 月 3 日
Let me explain what you are trying to do.
Given a PURE exponential decay curve.
y = y0*exp(-t/tc)
Assume that you locate the 36% decay point on the curve, so the value t_36 such that
y(t_36)/y(t0) = 0.36
See that this corresponds to the ratio
0.36 = exp(-t_36/tc)/exp(-t0/tc)
So y0 goes away. Taking the log of both sides, we have
log(0.36) = -(t_36 - t0)/tc
So you can recover the time constant tc as
tc = -(t_36 - t0)/log(0.36)
But, we know that
log(0.36)
ans =
-1.0217
So log(0.36) is darn near -1. Actually, the 36.788% point is what you might want, to be mathematically pedantic.
exp(-1)
ans =
0.36788
But if we assume that log(.36) is close enough to -1, then we have a simple estimate for the time constant as simply:
tc = t0 - t_36
But that ONLY applies to the very simple case of an absolutely pure exponential decay.
What you are trying to do completely invalidates what I just did above.
John D'Errico
John D'Errico 2018 年 3 月 3 日
For the case of a curve with a non-zero asymptote, I gave it to you already! READ MY ANSWER. There I showed you a very simple code to compute that time constant, requiring all of two lines of MATLAB code. In fact, I also gave you a complete derivation thereof.

サインインしてコメントする。


Walter Roberson
Walter Roberson 2018 年 3 月 2 日
The time constant tu1=3800 applies to a pure exponential. You do not have a pure exponential: you have an exponential plus a constant. If you look at 3800 you will see 0.88 plus the constant.
  1 件のコメント
friet
friet 2018 年 3 月 2 日
So at t=3800, i got 1.136. and this is not equal to 0.88+0.5=1.38.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeResampling Techniques についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by