# lowpass butterworth magnitude response

1 visualizzazione (ultimi 30 giorni)
Võ Trung il 18 Dic 2022
Commentato: Võ Trung il 18 Dic 2022
Guys, im doing this matlab file for my assignment. I must have the magnitude response starts at 40db at 0khz.
My idea is that it should be 0db at 0 frequence in the magnitude response so that i can mulplify k*100 to satisfy this. But its over 200 from the start. I have no idea what to do. Please explain to me. Thank you
##### 0 CommentiMostra -2 commenti meno recentiNascondi -2 commenti meno recenti

Accedi per commentare.

### Risposta accettata

Paul il 18 Dic 2022
Hi Võ
The zp2sos command in the code returns a second output, g, which is a gain that has to be applied to the filter response.
Here is the code
Fs = 44100; %tan so lay mau
Fn = Fs/2;
Wp = 2500/Fn; %tan so bien dai thong
Ws = 4000/Fn; %tan so biet dai chan
Rp = 3; %do loi dai thong
Rs = 55; %do loi dai chan
%thiet ke va tim bac bo loc
[n,Wn] = buttord(Wp,Ws,Rp,Rs);
[z,p,k] = butter(n,Wn);
%ve dap ung xung cho 100 trong so
[sos,g] = zp2sos(z,p,k);
Plotting the response of the sos portion.
freqz(sos)
The value of g is
g
g = 1.1602e-11
which can be converted to dB, and we see that applying it to the filter would result in 0 dB gain at dc
20*log10(g)
ans = -218.7093
Alternatively, use the single output form of zp2sos the gain will be embedded in the sos, resulting in it having the expected response.
sos = zp2sos(z,p,k);
freqz(sos)
##### 1 CommentoMostra -1 commenti meno recentiNascondi -1 commenti meno recenti
Võ Trung il 18 Dic 2022
it's clear to me now , thank you so much.

Accedi per commentare.

### Categorie

Scopri di più su Digital Filter Analysis in Help Center e File Exchange

### Community Treasure Hunt

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

Start Hunting!

Translated by