Simple LowPass Filter and the explanation

4 visualizaciones (últimos 30 días)
Hafiz azizi
Hafiz azizi el 27 de Abr. de 2017
Comentada: Star Strider el 3 de Mayo de 2017
Hi everyone, I just want to create a low pass filter with a cut-off frequency of 2.4 kHz and sampling frequency of 11 kHz.
Also, I do not really understand this part 'Fp,Fst,Ap,Ast'
This might be easy for most of you, but I am completely new to matlab, so thank you so much in advance.
p/s: is there a way to get the moving average/smoothing using matlab? note that I am quiet confused between the difference, if there is a way, can help me with that too?

Respuesta aceptada

Star Strider
Star Strider el 27 de Abr. de 2017
‘Also, I do not really understand this part 'Fp,Fst,Ap,Ast'’
You do not need to understand it. There are several ways to design filters in MATLAB.
I prefer designfilt (introduced in R2014a) to the older dfilt for more complex filters. For simpler filters, it is easy to design filters with individual function calls.
This works for your filter (the lowpass design is the default, so you do not need to specify it):
Fs = 1.1E+4; % Sampling Frequency
Fn = Fs/2; % Nyquist Frequency
Wp = 2.40E+3/Fn; % Passband Frequencies (Normalized)
Ws = 2.41E+3/Fn; % Stopband Frequencies (Normalized)
Rp = 10; % Passband Ripple (dB)
Rs = 50; % Stopband Ripple (dB)
[n,Ws] = cheb2ord(Wp,Ws,Rp,Rs); % Filter Order
[c,b,a] = cheby2(n,Rs,Ws); % Filter Design
[sosbp,gbp] = zp2sos(c,b,a); % Convert To Second-Order-Section For Stability
figure(1)
freqz(sosbp, 2^16, Fs) % Bode Plot Of Filter
The freqz call is not necessary for the code. It demonstrates how the filter works and that it does what you want it to.
  4 comentarios
Hafiz azizi
Hafiz azizi el 3 de Mayo de 2017
Thanks, you are a kind person, that helps me lot in understanding matlab filter. Kudos to you!
Star Strider
Star Strider el 3 de Mayo de 2017
My pleasure.
Thank you.

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by