matlab中数据的衰减率

decay rate of data in matlab

我想知道一些数据 returns 在初始峰值后达到基线的速度有多快(此处约为 x=5);

二次拟合看起来是正确的(来自 matlab 的数字选项,如下所示)- 但我正在寻找 这条曲线的简明量化 ,因此我认为'decay rate'的指数函数就很简单了。

  1. 这个假设是否正确?
  2. 如果是,我为此查看了 wiki 上的公式,并无耻地试图找到时间常数的解(但没有成功)。有人可以帮助我吗,或者这实际上不是一个微不足道的问题?

编辑:我计划使用 MathWorks 的 findpeaks() 函数找到峰值,并使用 'inverse' findpeaks() 找到曲线的最低点(如:-y)

%approx data values of the curves below
y= [0   0.07    0.08    0.08    0.08    0.06    0.06    0.05    0.04    0.05    0.04    0.02    0.01    0.02    0.01    0.01    0.03    0.02    0.02    0.02    0.03    0.01    0.02    0.01    0.01    0.03    0.02    0.01    0.02    0.01];
x=1:numel(y);
plot(x,y);

这是我一直在寻找的两个选项,也许有人可以详细说明/改进这个关于这些方法的差异的答案 - 对我来说这已经足够了,感谢您的评论。在此步骤之前,使用问题示例中提供的数据,必须提取局部最大值和最小值,这可以使用 findpeaks()

轻松完成

方法 1) 需要 Matlab 的曲线工具箱 [Source]

%Fit a Single-Term Exponential Model, copy from Mathworks documentation, all credits go there
x = (0:0.2:5)';
y = 2*exp(-0.2*x) + 0.1*randn(size(x));
f = fit(x,y,'exp1')
f = 
     General model Exp1:
     f(x) = a*exp(b*x)
     Coefficients (with 95% confidence bounds):
       a =       2.021  (1.89, 2.151)
       b =     -0.1812  (-0.2104, -0.152)
plot(f,x,y)


或方法 2) 需要来自 Matlab 的优化工具箱 [Source]


%copy from Mathworks documentation, all credits go there
rng default % for reproducibility
d = linspace(0,3);
y = exp(-1.3*d) + 0.05*randn(size(d));
fun = @(r)exp(-d*r)-y;
x0 = 4;
x = lsqnonlin(fun,x0)
plot(d,y,'ko',d,exp(-x*d),'b-')
legend('Data','Best fit')
xlabel('t')
ylabel('exp(-tx)')