Finding sample frequency?

조회 수: 5 (최근 30일)
Mordecai
Mordecai 2017년 3월 12일
댓글: Star Strider 2017년 3월 12일
Alright so I have a text file of 600 samples from a ECG.
Using this code, I found the peaks:
%Find ECG peaks
close all, clear all, clc
sig=load('ecg.txt'); %Load
plot (sig) %plot
xlabel('Samples')
ylabel('Electrical Activity')
title('ECG Signal')
hold on, plot(sig,'ro')
Peak=0; %Peak Value
Beat_count=0 %Number of Heartbeat
for i=2:length(sig)-1
if(sig(i)>sig(i-1) && sig(i)>sig(i+1) && sig(i)>1.7)
disp ('Peak found')
i, Peak=sig(i)
Beat_count=Beat_count+1
end
I also created a graph comparing samples to electrical activity.
The question says: "Plot a circle around each of the P wave peaks that you have found." So I'm guessing I need to take this a step further, but I'm stuck. It also says: (*hint: In the time vector, tmax can be determined by subtracting 1 from the sample size and dividing by the sample frequency.) But how can I find the sample frequency without time? Or am I overthinking this and the graph above is all I need?
  댓글 수: 2
Chad Greene
Chad Greene 2017년 3월 12일
Sounds like your professor has given you a time vector. Is sig a vector or is it 2D? As an aside, I suspect you only need to plot red circles at the peaks, not at every sig data point. So instead of
plot(sig,'ro')
try
plot(sig(sig>1.8),'ro')
Star Strider
Star Strider 2017년 3월 12일
You must be provided the sampling frequency or sampling interval. There is no way to determine it from the data alone. To detect the P-waves, you have to use the findpeaks function and the intersect function to find the points between 0.5 and 0.7. Those will be the P-waves, at least in the EKG segment you posted.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by