How to extract frequency-domain features using the power spectral density (PSD) in matlab
조회 수: 22 (최근 30일)
이전 댓글 표시
I'm new to Matlab. I'm doing ECG analysis. first, I have calculated the R peaks of the ECG signal, then I have calculated the RR interval from the index of R peaks, so I got RR_interval vector (1x7831 double). Now, I need to create a sliding window with width of N=158 samples over RR_interval vector to extract some frequency-domain features using the power spectral density (PSD), For example, for each part of the windowed signal 3 features need to be calculated such as1)LF: Power of the low-frequency band (0.04–0.15 Hz) in a PSD,2)HF: Power of the high-frequency band (0.15–0.4 Hz) in a PSD,3)LF/HF: Ratio of LF to HL. I'm looking for someone to help me finding a tutorial or sample code for extracting frequency-domain features using the power spectral density (PSD) in Matlab. PLEASE HELP!
댓글 수: 1
KM Crs
2019년 7월 21일
편집: KM Crs
2019년 7월 21일
Hi! We're doing the same for our project, only it would be in simulink. Can you share us your code as to how you get it? thank you so much in advance. We really need this for our project. Hoping for your positive response.
you can send it here-- maelyn215@gmail.com
답변 (1개)
Star Strider
2017년 2월 16일
I would create bandpass filters for each band in (1) and (2) and then filter your signal with them and do the calculation in (3) on the resulting vectors. You must know your sampling frequency to design your filters.
I would use the designfilt (link) function to design Chebyshev Type II filters for each band, with the passband for the first filter as 0.04–0.15 Hz, stopbands of 0.01 and 0.18 Hz. The passband for the second filter is 0.15–0.4 Hz with stopbands at 0.12 and 0.42 Hz. You may have to adjust the stopbands to get a stable filter. Note that they must be greater than zero and less than the Nyquist frequency (half the sampling frequency).
Use the filtfilt function to do the actual filtering.
To get the resulting power, square the amplitudes of the outputs of both filters, then do the ‘LF/HF’ calculation.
Note that you must use IIR filters because your signal is not long enough for a FIR filter with the steep rolloffs your filters require.
댓글 수: 2
Star Strider
2017년 2월 16일
One definition of PSD is simply the squared amplitude in the frequency domain. If you want to do your analysis in the time domain, my original Answer will work.
Your record length of 720000 samples is long enough for either a FIR or IIR filter.
Since you must do it in the frequency domain, you can use the fftfilt function. You must use FIR filters for that, so you can use designfilt to design the FIR filters. It seems that you will have to do the filtering for every 158-sample window. You can create a matrix of your 158-sample vectors, but it will likely be easier for you to use a loop and loop through the segments, do the filtering, and then the resulting calculations, then store the results.
Sampling interval is the inverse of sampling frequency, so if ‘Fs’ (in samples/time) is sampling frequency and ‘Ts’ (in time/sample) is sampling interval:
Fs = 1/Ts;
You must use the filters to correctly extract the energy in the frequency bands you want. This applies whether you are filtering in the time domain with filtfilt function or in the frequency domain with the fftfilt function.
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!