필터 지우기
필터 지우기

Using the lowpass function

조회 수: 3 (최근 30일)
L'O.G.
L'O.G. 2022년 7월 7일
답변: Paul 2022년 7월 8일
In using the lowpass function, how can you suppress the display after? (The default implementation outputs plots of the time-domain signal and power spectrum, comparing the original signal to the filtered one.) Also, are there any good rules of thumb for selecting the passband frequency and steepness? I feel like the latter should be as high as possible.

채택된 답변

Star Strider
Star Strider 2022년 7월 7일
The lowpass function does not display anything unless you leave the trailing seimcolon off of the lowpass call. It will design a very good elliptic filter if you inclued the name-value pair 'ImpulseResponse','iir.
  댓글 수: 2
L'O.G.
L'O.G. 2022년 7월 7일
Thank you so much! And regarding the passband frequency and steepness, are there any rules of thumb?
Star Strider
Star Strider 2022년 7월 7일
My pleasure!
It is possible to design those specifically with the designfilt funciton, however not with lowpass. It designs a very good generic elliptic filter if you ask it to. The passband frequency is entirely dependent on the signal being filtered, and the best way to determine that is with a Fourier transform.
Example —
t = linspace(0, 20, 250); % Time Vector
s = sum(sin([1:5]'*2*pi*t)); % Signal Vector
Fs = 1/(t(2)-t(1)); % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
figure
plot(t, s)
grid
xlabel('t')
ylabel('s')
title('Original Signal')
L = numel(t);
NFFT = 2^nextpow2(L);
FTs = fft(s, NFFT)/L;
Fv = linspace(0, 1, NFFT/2+1)*Fn;
Iv = 1:numel(Fv);
figure
plot(Fv, abs(FTs(Iv))*2)
grid
xlabel('Frequency')
ylabel('Amplitude')
s_filt = lowpass(s, 1.5, Fs, 'ImpulseResponse','iir'); % Set Stopband = 1.5 Hz
figure
plot(t, s_filt)
grid
xlabel('t')
ylabel('s')
title('Lowpass Filtered Signal')
.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Paul
Paul 2022년 7월 8일
The only way to suppress the plot output is to specify at least one output argument (or use lowpass() in an expression, like 1*lowpass(...) )
If calling lowpass() alone without output arguments, why would you want the plots suppressed?

카테고리

Help CenterFile Exchange에서 Measurements and Feature Extraction에 대해 자세히 알아보기

제품


릴리스

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by