High-pass filter

80 次查看(过去 30 天)
Hello,
I'm working on acceleration signals coming from an accelerometer that has a sensitivity change of 0% from 2 Hz to 10000 Hz. When I perform the FFT of one this accelerometric signals I often obtain strong low frequency contents close to 0.1 Hz. I would like to cut away all the frequencies before 2 Hz because I don't think they are correct. The code I used is:
Fca=2; %cutoff frequency
[z,p,k]=butter(8,Fca/(Fsa/2),'high');
sos=zp2sos(z,p,k);
%fvtool(sos,'Analysis','freq')
xafiltfilt=filtfilt(sos,g,xa);
%figure;
%plot(ta,xa,ta,xafiltfilt);
%grid on
%title('xa (accelerometric signal)')
%xlabel('t (s)')
%ylabel('Acceleration (g)')
%legend({'Original xa Signal','Actual xa Signal (filtered and realigned signal)'});
%saveas(gcf,'x_acc_filt_comp','jpg')
Xaf=fft(detrend(xafiltfilt),NFFT2_acc)/Na;
figure;
plot(fa,2*abs(Xaf(1:NFFT2_acc/2+1)))
grid on
title('Single-Sided Amplitude Spectrum of xa(t) filtered and realigned Signal')
xlabel('f (Hz)')
ylabel('Xa_filtered(f)')
I was wondering if this type of filter may be adequate.
Thank you very much,
Guglielmo

采纳的回答

Star Strider
Star Strider 2021-5-12
It could work, however a better option could be:
Fca = 2;
Fsa = 1000; % Create Parameter
xa = randn(1E+4,1); % Create Signal
[xafiltfilt,hpdf] = highpass(xa, Fca, Fsa, 'ImpulseResponse','iir');
figure
freqz(hpdf.Coefficients, 2^16, Fsa)
set(subplot(2,1,1), 'XLim',[0 10]) % Zoom Frequency Axis
set(subplot(2,1,2), 'XLim',[0 10]) % Zoom Frequency Axis
Compare to the Butterworth design:
[z,p,k]=butter(8,Fca/(Fsa/2),'high');
sos=zp2sos(z,p,k);
figure
freqz(sos, 2^16, Fsa)
set(subplot(2,1,1), 'XLim',[0 10]) % Zoom Frequency Axis
set(subplot(2,1,2), 'XLim',[0 10]) % Zoom Frequency Axis
.
  28 个评论
Guglielmo Giambartolomei
Very easy! You are the best! I will always be grateful for your help! Thank you very much!
I was confused because in the previous example we wrote Ws=1.0/Fn and we said that the stopband corner frequency was 2 Hz. As a matter of fact is 1 Hz.
Best regards,
Guglielmo
Star Strider
Star Strider 2021-7-22
As always, my pleasure!
I do not see where I typed that, however I do not always catch all my typographical errors.
.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matched Filter and Ambiguity Function 的更多信息

产品


版本

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by