フィルターのクリア

Finding distance between values in a column vector

13 ビュー (過去 30 日間)
Allen Antony
Allen Antony 2020 年 10 月 28 日
コメント済み: Allen Antony 2020 年 10 月 28 日
Basically I used the findpeaks function to find the time values of a graph I had. Using this code shown below.
[PeakHeight,PeakTime]=findpeaks(ECG_Clean);
disp(PeakTime)
This gave the time for when each peak occured as a column vector. I want to find the average time between each peaks but when I do the following function it gives me the average time and not the average time gap between each peak.
AvgPeakDistance = sum(PeakTime(:))/numel(PeakTime);
So basically, I was wondering how to find the distance between values in a column vector, so that I could find the average of it.
Thanks

採用された回答

KSSV
KSSV 2020 年 10 月 28 日
dPeakTime = diff(PeakTime) ; % get the difference between consecutive PEak times
AvgPeakDistance = sum(dPeakTime)/numel(dPeakTime);
  1 件のコメント
Allen Antony
Allen Antony 2020 年 10 月 28 日
Thanks it works perfectly

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeDescriptive Statistics についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by