ecg signal frquency contents
10 次查看(过去 30 天)
显示 更早的评论
I need to determine frequncy contents of an ecg signal which i have loaded from a file , but the sampling frequency is Fs=1.0e+04 * 1.7869 I used fft , but when i plot i get frequencies close to zero .
X1=load( ) sig = load(fn) ; sig=x1(:,2); t=x1(:,1); Ls=length(sig); Fs=Ls/t(end)-t(1); I get : Fs=1.0e+04 * 1.7869 Nfft=2^nextpow2(Ls) Y = fft(sig,Nfft)/Ls; f=Fs/2*linspace(0,1,Nfft/2+1); subplot(2,1,2) plot(f,abs(fftshift(Y(1:Nfft/2+1))))
0 个评论
采纳的回答
Mohamad
2018-6-7
2 个评论
Sandro Lecci
2018-6-7
Dear Moh,
If I run your code on your data, this is what I get after I zoom in the low frequencies.
As you see, most of the "activity" can be seen <10 Hz. Would you like to extract the sympathetic/parasympathetic activity from it? Then you should first extract the heart rate variability value (calculate the interval between consecutive R-waves) and perform the same analysis (frequency extraction).
Best, Sandro
更多回答(1 个)
Sandro Lecci
2018-6-6
Dear Moh,
I recommend you substract the signal average to get rid of the very low frequencies.
Just write this:
Y = fft(sig-mean(sig), Nfft)/Ls;
Best, Sandro
1 个评论
Sandro Lecci
2018-6-7
Could you please do the following on your last comment:
-highlight the portion of code -hit the "code button" to display it in a more readable way
I personally do the fft calculation slightly different (I don't use fftshift) but I assume the theory behind is correct. What is strange is the X-axis, it should be centered to zero, which makes your whole spectrum range from 0 to ~500 and considering the properties of an ECG signal you should focus on the low frequencies (LF and VLF) that range < 1Hz.
to calculate the power I do the following:
Fs = 1000; %Hz
xfreq = linspace(0,1, length(signal)/2+1)*(Fs/2); %calculate x frequency vector
tempfft = abs(fft(signal- mean(signal))); %perform fft and extract the real part of it
tempfft = tempfft./length(signal); % divide by the number of samples
tempfft = tempfft.^2; %square it
tempfft = tempfft./xfreq(2); % calculate PSD by dividing by the frequency resolution (second point in the xfreq vector)
myFFT= tempfft(1:end/2+1); % take the first half of it
plot(xfreq,myFFT); xlabel('Frequency'); ylabel('PSD')
Best,
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 ECG / EKG 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!