Using the lowpass function

7 visualizaciones (últimos 30 días)
L'O.G.
L'O.G. el 7 de Jul. de 2022
Respondida: Paul el 8 de Jul. de 2022
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.

Respuesta aceptada

Star Strider
Star Strider el 7 de Jul. de 2022
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 comentarios
L'O.G.
L'O.G. el 7 de Jul. de 2022
Thank you so much! And regarding the passband frequency and steepness, are there any rules of thumb?
Star Strider
Star Strider el 7 de Jul. de 2022
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')
.

Iniciar sesión para comentar.

Más respuestas (1)

Paul
Paul el 8 de Jul. de 2022
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?

Categorías

Más información sobre Matched Filter and Ambiguity Function en Help Center y File Exchange.

Productos


Versión

R2021b

Community Treasure Hunt

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

Start Hunting!

Translated by