Create a plot for local max peaks given a certain time range.

2 ビュー (過去 30 日間)
Shamus Sim
Shamus Sim 2020 年 8 月 10 日
編集済み: Adam Danz 2020 年 8 月 14 日
This is the code I am running for an ECG data.
Imagine that
sf = 399.0698; %sampling frequency (Hz), samples per second
T = 1/sf;
timeSeries = T:T:600.8122; %time intervals
% graph with circled peaks (needs debugging)
[pks,locs] = findpeaks(y(1,:),'MinPeakDistance',0.3);
plot(timeseries,y(1,:),timeseries(locs),pks,'or'),xlabel('Time (s)'),ylabel('Amplitude(uV)')
%y(1,:)is the signal I have filtered; its points traverse horizontally on row 1
% timeSeries is my time intervals on my X axis
I have a signal y(1,:) with a sampling frequency of 399.0698 and the total length of signal is 600s. I have found the local max for the signal y(1,:) I would like to plot a graph such that the peaks are circled and I can choose which part of the signal to show. Example 590-591seconds.
Thank you!
  5 件のコメント
Shamus Sim
Shamus Sim 2020 年 8 月 11 日
Hi Adam. I have already entered it as an attachment.
Shamus Sim
Shamus Sim 2020 年 8 月 11 日
also its an EEG signal not ECG

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

回答 (1 件)

Adam Danz
Adam Danz 2020 年 8 月 11 日
It's unclear what some of your variables are and how they relate to each other. For example, what's the second row of y? How does timeSeries (1x239766) related to y (2x100)? What is x?
Here's how to circle the peaks when (x,y(1,:)) is used to plot the data.
plot(x,y(1,:))
hold on
plot(x(locs),y(1,locs), 'ro')
To address the time cutoffs of 590-591, I'll need more info.
  2 件のコメント
Shamus Sim
Shamus Sim 2020 年 8 月 11 日
Hi Adam. Thanks for your reply. I have re-edited the question, hopefully its clearer.
y is just a shortened section of the EEG data where I concatenated its corresponding time data on row 2. Therefore, row 1 has the EEG data readings and row 2 has its corresponding time values.
Adam Danz
Adam Danz 2020 年 8 月 12 日
編集済み: Adam Danz 2020 年 8 月 14 日
I'm not sure what you changed. Have you run the code you shared? It uses two different forms of the variable "timeSeries" vs "timeseries".
" I would like to plot a graph such that the peaks are circled and I can choose which part of the signal to show."
My answer shows you how to do the first part. You can apply that method to whatever variables you're using.
As for the second part about choosing which part of the signal to show, I don't know what your question is.

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

カテゴリ

Help Center および File ExchangeBiomedical Signal Processing についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by