Digital Filter from coefficients

9 Ansichten (letzte 30 Tage)
gbernardi
gbernardi am 13 Mai 2011
Hello everybody. I am trying to do some review exercises about filters. In particular, I'm trying to convert a filter from analog to digital. I'm working with an analog filter (a simple bandpass filter) whose transfer function can be described by:
TF = 1./(1+ (1j*Q*(f./fc - fc./f)));
where f is the frequency vector, fc is the center frequency of the filter and Q is the Q-factor.
I just wanted to have the same filter in a digital domain form (I know that I could also use invfreqz using TF as a parameter but I don't want to do it that way), so I thought I could just extract the coefficients from the TF in the continuous domain, which are:
a1 = [Q*1i fcs(k) -Q*1i*fcs(k)^2];
b1 = [fcs(k) 0];
use the bilinear transformation
[numd,dend] = bilinear(b1,a1,8e3);
and finally get the frequency response of it by
h1 = freqz(numd, dend, f,8e3);
but the frequency response I obtain here is different from the previous one as it appears to be shifted in frequency when I plot them:
plot(f,20*log10(abs(TF)))
hold on;
plot(f,20*log10(abs(h1)),'m')
I'm sure I'm doing some silly mistakes, but I'd like to have some hints ;)
Thanks in advance. Giuliano

Antworten (1)

gbernardi
gbernardi am 17 Mai 2011
I found out that by using the 4th parameter of the function bilinear the filters are shifted.
I don't really understand why, but with a value of approximately 3700 causes the right frequency shift.
Anyway, now that the filters have the same center frequencies, it's clear to see that their shapes are not exactly the same...
I'm even more puzzled xD

Community Treasure Hunt

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

Start Hunting!

Translated by