Anyway, I have a basic LP DFI filter in Octave that plots nicely the frequency response. I put the code in C++ and I get the same output y(n) (obviously). However, this is when I don't know what to do next.
In Octave I simply do:
Code: Select all
[h,w] = freqz(y,1,4096,Fs);
Code: Select all
semilogx(w,20*log10(abs(h)));
I have this code, but not sure how to get to a plot... (I already calculated the coefficients earlier to get y(n))
Code: Select all
double num = (b0 * b0) + (b1 * b1) + (b2 * b2) + (2.0 * cosW0 * ((b0 * b1) + (b1 * b2))) + (2.0 * cos2W0 * b0 * a2);
double den = 1.0 + (a1 * a1) + (a2 * a2) + (2.0 * cosW0 * (a1 + (a1 * a2))) + (2.0 * cos2W0 * a2);