how can I normalizd ecg spectrum frequency?

Hi,I'm doing project of ecg. I want to convert ecg signal to frequency domain. The code for spectrum frequency :
clc
load('bu_16265.mat');
s=yout(1,:);
fs=128;
NFFT=2^nextpow2(length(s));
Y=fft(double(s),NFFT)/length(s);
f=(double(fs)/2*linspace(0,1,NFFT/2));
amp=2*abs(Y(1:NFFT/2));
figure;
plot (f,amp);
title ('NORMAL 16265');
xlabel('Frequency (Hz)');
ylabel ('Power');
From this code I get graphic with range frequency 0-64 Hz, can you help me to normalized the frquency? Thank you :)

Answers (1)

Wayne King
Wayne King on 1 Aug 2013
Edited: Wayne King on 1 Aug 2013
If you have the Signal Processing Toolbox, just use periodogram without specifying the sampling frequency and you'll get normalized frequency.
Otherwise just create a frequency vector that goes from 0 to \pi instead of using the sampling frequency to create the vector in Hz as you have done above.
f = (pi*linspace(0,1,NFFT/2));
Or just
f = linspace(0,1,NFFT/2);
If you want [0,1].
Again, I would recommend just using periodogram() for what you've done if you have Signal.

Asked:

on 1 Aug 2013

Community Treasure Hunt

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

Start Hunting!