Using the lowpass function

11 ビュー (過去 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 Center および File ExchangeMatched Filter and Ambiguity Function についてさらに検索

製品


リリース

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by