Using the lowpass function

2 次查看(过去 30 天)
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 中查找有关 Matched 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