我想测量图中所示的相邻波的峰值/低点之间的时间段。
这是细胞中钙浓度的振荡行为。峰值不一样,因此我需要计算每个波的峰值/低点,获得与峰值/低点相关的相应时间,并且找到相邻峰值/低点之间的差异。我每次都存储钙浓度值" 0.01
"。
任何人都可以建议我如何编码吗?我宁愿使用较小的代码行。
答案 0 :(得分:1)
查看内置的findpeaks函数,该函数可以返回信号中峰值的索引。
您可以通过首先平方信号来使用它来查找信号中的低点。这样的东西可以工作(我没有在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);