

Problem with design of iir lpf filter.
Respected Sir / Madam I am developing scilab for iir butterworth LPF. Once after designing the filter I am trying to check the filter output. The output does not what I was looking for. Please help me in this regard. I am posting the code as well. Your help will be priceless. Yours sincerely T.V.Chandra Shekar
//Low Pass IIR Butterworth Filter clc; clear; close; fs = 8000; omegap = 500; omegas = 2000; wp = omegap/fs; ws = omegas/fs; A1_dB = -3; A2_dB = -40; A1 = (10)^(A1_dB/20); A2 = (10)^(A2_dB/20); N = 0.5*(log10(1/A1^2 -1)-log10(1/A2^2 -1))/(log10(500)-log10(2000)); disp(ceil(N)); hz = iir(ceil(N),'lp','butt',[wp ws],[A1 A2]); [hzm fr] = frmag(hz,1024); subplot(2,1,1); plot2d(fr',hzm');xgrid(color("green")); xtitle('Magnitude Spectrum','Normalized Frequency','Magnitude in dB'); disp(hz); n = coeff(hz.num); n = flipdim(n,2); disp(n); d = coeff(hz.den); d = flipdim(d,2); disp(d); n = 0:1023; x = sin(2*%pi*500*n/fs) + cos(2*%pi*2000*n/fs); y = filter(n,d,x); Y = abs(fft(y))/1024; disp(Y); f = (0:1023)*fs/1024; subplot(2,1,2); plot2d(f,Y);
Scilab


If you can tell us what you are expecting as the output, we can help.
Login to add comment