# variance and psd of the ecg signal

9 views (last 30 days)
m on 28 Sep 2011
Hello i am new in matlab and i have two question :
first: i can calculate the psd of ECG signal (with your help): "psdest = psd(spectrum.periodogram('Hamming'),sig,'NFFT',4096,'Fs',250);"
but i want to get percentage of the total power in a 2.7 Hz bandwidth symmetrically distributed around the dominant frequency( the frequency where the PSD is maximum), then normalized that in the 2.5–14 Hz range
and my secound question : how i can calculate the variance of ECG signal from time-domain ECG signal (without windowing)?

Wayne King on 29 Sep 2011
Hi, how is this different than:
If you want to normalize based on the 2.5-14 Hz band instead of 0 to the Nyquist as I did in my example, then you can do that, just use that interval in avgpower(psdest,[2.5 14])
To choose the 2.7 Hz bandwith around the maximum frequency, you just need to know the frequency spacing which you can get from
df = psdest.Frequencies(2)-psdest.Frequencies(1);
From that you can construct an interval that is maximum frequency plus or minus 2.7/2
Fs = 250;
t = 0:1/Fs:4-(1/Fs);
sig = cos(2*pi*10*t)+randn(size(t));
psdest = psd(spectrum.periodogram('Hamming'),sig,'NFFT',4096,'Fs',250);
[mx,I] = max(psdest.Data);
df = psdest.Frequencies(2)-psdest.Frequencies(1);
numbins = round((2.7/2)/df);
relperc = ...
100*avgpower(psdest,[psdest.Frequencies(I-numbins) psdest.Frequencies(I+numbins)])/avgpower(psdest,[0 Fs/2])
To normalize on [2.5 14]
100*avgpower(psdest,[psdest.Frequencies(I-numbins) psdest.Frequencies(I+numbins)])/avgpower(psdest,[2.5 14])
The variance in the time domain is just var().
Wayne King on 29 Sep 2011
By the way, you better hope that the maximum power is in the interval [2.5, 14] Hz or normalizing on that interval won't make sense.

### Categories

Find more on Transforms in Help Center and File Exchange

### Community Treasure Hunt

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

Start Hunting!