Why does the psd of my filtered signal perfectly overlap my raw signal's one?
11 ビュー (過去 30 日間)
古いコメントを表示
I have been given an eeg signal that has already been filtered passband [1Hz 30Hz] and resampled from 128Hz to 64Hz.
I obtained its psd using pwelch and, because there was still quite the activity after 30Hz, I tried to filter it lowpass with a cutoff frequency of 30Hz. I tried with both cheby2 and butter, but the psd of the filtered signal is a perfect match with the previous one.
% Butter
fny = fc/2;
ft_l = 30/fny;
order = 5;
[b_l, a_l] = butter(order,ft_l,"low");
freqz(b_l,a_l,NFFT,fc)
% Cheby2
Wp = 30/fny;
Ws = 35/fny;
Rp = 1;
Rs = 60;
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs);
[z,p,k] = cheby2(n,Rs,Ws);
[sos,g] = zp2sos(z,p,k);
figure, freqz(sos, 2^16, fc)
0 件のコメント
回答 (1 件)
Mathieu NOE
2024 年 3 月 27 日
hello
see code below, the effect of the low pass filter is clearly to be seen on the psd plot
now I wonder whatkind of "activity" you can see above 30 Hz for a signal sampled at 64 Hz (??)
to avoid such strange sitation, the demo below has fc = 100 Hz (NB I would prefer "fs" for the sampling rate , as "fc" is usualy something that is related to a cuting / corner frequency
% dummy signal
fc = 100; % sampling rate
x = randn(1000,1);
% Butter
fny = fc/2;
ft_l = 30/fny;
order = 5;
[b_l, a_l] = butter(order,ft_l,"low");
NFFT = 128;
freqz(b_l,a_l,NFFT,fc)
y = filter(b_l, a_l,x); % filter the signal
% psd
p1 = pwelch(x);
p2 = pwelch(y);
f = linspace(0,fny,numel(p1));
figure
semilogy(f,p1,'b',f,p2,'r')
2 件のコメント
参考
カテゴリ
Help Center および File Exchange で Parametric Spectral Estimation についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!