Clear Filters
Clear Filters

hrv spectral analysis

11 views (last 30 days)
Olga
Olga on 9 Feb 2012
Edited: Jan on 7 Oct 2013
Hi, I'm trying to perform the spectral analysis for HRV of ECG signals. I've done the PSD,but how do I split the spectrum into these frequency bands for HRV parameters (ULF, VLF, LF, HF - 0,003 to 0,4 Hz)? How do I show it on the plot power[ms^s](frequency[Hz])? I've done psd with this code:
fs = 400;
xdft = fft(odstepRR);
xdft = xdft(1:length(odstepRR)/2+1);
xdft(2:end-1) = 2*xdft(2:end-1);
psdest = 1/(length(odstepRR)*fs)*abs(xdft).^2;
freq = 0:fs/length(odstepRR):fs/2;
plot(freq/100,10*log10(psdest));
grid on;
btw. odstepRR is my vector with NN intervals. Shall be very gratefull for your help. ;)

Answers (1)

Wayne King
Wayne King on 9 Feb 2012
Hi Olga, you have your frequencies in your freq vector. You can use that information to subset your psdest vector.
Keep in mind that your frequency resolution is determined by the sampling frequency and the length of the data vector. So depending on how long odstepRR is, you may have a very small step between elements of freq (much less than 1 Hz), or a step much larger than 1 Hz.
But you can do something like
indices = find(freq> 0.1 & freq<0.4);
ULF = psdest(indices);
to separate the power estimates in the band.
If you use spectrum.periodogram from the Signal Processing Toolbox, there is an avgpower() method that you can use to integrate the power in the PSD estimate over a given interval.
x = randn(1024,1);
psdest = psd(spectrum.periodogram,x,'Fs',400,'NFFT',length(x));
ULFpower = avgpower(psdest,[0.1 0.4]);
  4 Comments
Olga
Olga on 12 Feb 2012
And it is not possible to change the units, is it?
Wayne King
Wayne King on 13 Feb 2012
the PSD is in squared units by definition.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!