0
Design of fir filters using windowing technique

Respected Sir / Madam I am developing code for fir filters using windowing technique. During the check process I am not fining any difference for a with in the allowable band and out of the band frequencies. I am posting the code as well.I am failing to interpret the output spectrum. Your help will be priceless. Yours sincerely T.V.Chandra Shekar

clc;
clear;
close;
omegap = 1200;
omegas = 1700;
fs = 8000;
rp = 0.01;
rs = 0.02;
wp = omegap/fs;
ws = omegas/fs;
N = ((-20*log10(sqrt(rp*rs)))-13)/(14.6*((omegas - omegap)/fs));
if (modulo(N,2)~=0) then
    N1 = N;
    N = N1-1;
else
    N1 = N + 1;
end
disp(N);
[wft,hm,fr]=wfir('lp',floor(N1),[wp],"re",[0 0]);
disp(wft);
subplot(2,1,1);
plot(fr,hm);xgrid(color("green"));
a = gca();a.x_location = "origin";a.y_location = "origin";
xtitle('Rectangular Window','f Frequecy','Magnitude');
den = [zeros(1,(length(wft)-1)) 1];
numpol = poly(wft,'z','coeff');
denpol = poly(den,'z','coeff');
firtff = syslin('d',numpol,denpol);
n = 0:1023;
x = 2*sin(2*%pi*2900*n/fs);
y = flts(x,firtff);
Y = abs(fft(y));
f = (0:1023)*fs/1024;
subplot(2,1,2);
plot2d(f,Y);xgrid(color("green"));
xtitle('Magnitude Spectrum Of Output','Frequency f','Magnitude');


Scilab 14-03-18, 6:26 a.m. chandrashekar

Answers:

Log-in to answer to this question.