High-pass filter

조회 수: 110 (최근 30일)
Guglielmo Giambartolomei
Guglielmo Giambartolomei 2021년 5월 12일
댓글: Star Strider 2021년 7월 22일
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
Guglielmo Giambartolomei 2021년 7월 22일
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에서 Signal Operations에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by