Digital Filter from coefficients
Show older comments
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
Answers (1)
gbernardi
on 17 May 2011
0 votes
Categories
Find more on Analog Filters in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!