ecg signal frquency contents
6 ビュー (過去 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.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/189353/image.png)
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,
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!