如何测量波峰或波谷之间的周期?
How to measure the period between the peaks or lows of waves?
我想测图中相邻波peaks/lows之间的周期
这是细胞中钙浓度的振荡行为。峰值不相同,因此我需要计算每个波的peak/lows,获得与peaks/lows相关的相应时间,求相邻peaks/lows之间的差异。我已经存储了每次“0.01
”的钙浓度值。
任何人都可以建议我应该如何编码吗?我更愿意使用更小的代码行。
查看内置的 findpeaks 函数,它可以 return 您的信号峰值索引。
您还可以使用它通过首先对信号求平方来找到信号中的低点。像这样的东西可以工作(我没有在 MATLAB 中尝试过,所以可能存在一些语法问题):
% Square the signal so that the lows become peaks
signal = signal .^ 2;
% Get the location of the peaks in terms of t (your time vector)
[~, peaksAndLows] = findpeaks(signal,t)
% Find the difference between consecutive peaks/lows
periodsBetweenPeaksAndLows = diff(peaksAndLows);
我想测图中相邻波peaks/lows之间的周期
这是细胞中钙浓度的振荡行为。峰值不相同,因此我需要计算每个波的peak/lows,获得与peaks/lows相关的相应时间,求相邻peaks/lows之间的差异。我已经存储了每次“0.01
”的钙浓度值。
任何人都可以建议我应该如何编码吗?我更愿意使用更小的代码行。
查看内置的 findpeaks 函数,它可以 return 您的信号峰值索引。
您还可以使用它通过首先对信号求平方来找到信号中的低点。像这样的东西可以工作(我没有在 MATLAB 中尝试过,所以可能存在一些语法问题):
% Square the signal so that the lows become peaks
signal = signal .^ 2;
% Get the location of the peaks in terms of t (your time vector)
[~, peaksAndLows] = findpeaks(signal,t)
% Find the difference between consecutive peaks/lows
periodsBetweenPeaksAndLows = diff(peaksAndLows);