Simple LowPass Filter and the explanation
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hafiz azizi
am 27 Apr. 2017
Kommentiert: Star Strider
am 3 Mai 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?
0 Kommentare
Akzeptierte Antwort
Star Strider
am 27 Apr. 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 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Filter Analysis finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!