Using the lowpass function
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
0 commentaires
Réponse acceptée
Star Strider
le 7 Juil 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 commentaires
Star Strider
le 7 Juil 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')
.
Plus de réponses (1)
Paul
le 8 Juil 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?
0 commentaires
Voir également
Catégories
En savoir plus sur Measurements and Feature Extraction dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!