Representing signals in the frequency domain after adaptive filtering

1 次查看(过去 30 天)
Hi,
I have a trajectory signal (represented in x, y and z plane) that is distorted by breathing (see attachednFigure 1 top and middle panels). I have corrected the trajectory signal by using an adaptive filter (see Figure 1 – bottom panel). I can see the difference the filter makes visually in the time domain (Figure 1 - only representing Y trajectory) but I would also like to represent it in the frequency domain. I tried doing so using the pspectrum function but it’s not clear (see attached Figure 2). Here is the code I used to generate Figure 2:
subplot(231)
plot(t, bre), title('Breathing Signal')
subplot(232)
plot(t, posY), title('Y-Trajectory with Breathing artefact')
subplot(233)
plot(t, posY_cor), title('Y-Trajectory without Breathing artefact')
subplot(234)
pspectrum(bre,fs,'spectrogram'), title('Breathing signal');
subplot(235)
pspectrum(posY,fs,'spectrogram'), title('Y-Trajectory with Breathing artefact');
subplot(236)
pspectrum(posY_cor,fs,'spectrogram'), title('Y-Trajectory without Breathing artefact');
I'm not sure if its to do with the way the power (dB) colour bar is represented within the psepctrum function as the range for the breathing signal is different for the trajectory signal.
Is this the best way to do it? Or are the signals too similar in frequency to discern any differences? Are there any other ways of doing this?
Thanks in advance!
  2 个评论
Impala
Impala 2019-12-17
Hi Piyush,
Many thanks for your response.
I was under the impression that the spectogram function I've used within pspectrum performs Fourier transform of the input signal.
Regardless, I've tried out your fft suggestion using the following code (data file attached):
N = length(posY);
f1 = (0:N-1)*fs/N;
f2 = (0:N/2)*fs/N;
fft_posY = fft(posY);
fft_posY_cor = fft(posY_cor);
fft_posYmag = abs(fft_posY/N);
fft_posY_cormag = abs(fft_posY_cor/N);
figure
subplot(211)
plot(f2, fft_posYmag(1:N/2+1)); title('Before filtering');
subplot(212)
plot(f2, fft_posY_cormag(1:N/2+1));title('After filtering');
The before/after filtering result is attached in the FFT.jpg file - there is a small difference between the two results around 0.3Hz (corresponds with the breathing signal) so looks like it is working!
But is there a way to get a color-intensity map like what the psepctrum function provides? I tried applying the pspectrum function to my fft outputs and I get figure pspecFFT.jpg - can't see any difference. But I don't think this is the right way of doing it as I think its reapplying the FFT.
Thanks once again!

请先登录,再进行评论。

回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by