blob: 1720e5155358660a7f52799236041e41fcdd5a5c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
//Graphical//
//Example 10.5.2
//Interpolation by 5, Filter Length = 30
//Cutoff Frequency Wc = %pi/5
//Pass band Edge frequency fp = 0.1 and a Stop band edge frequency fs = 0.16
// Choose the number of cosine functions and create a dense grid
// in [0,0.1) and [0.16,0.5)
//magnitude for pass band = 1 & stop band = 0 (i.e) [1 0]
//Weighting function =[3 1]
clear;
clc;
close;
M = 30; //Filter Length
I = 5; //Interpolation Factor = 5
Wc = %pi/5; //Cutoff Frequency
Wp = Wc/(2*%pi); //Passband Edge Frequency
Ws = 0.16; //Stopband Edge Frequency
hn=eqfir(M,[0 Wp;Ws .5],[1 0],[3 1]);
[hm,fr]=frmag(hn,256);
disp('The LPF Filter Coefficients are:')
hn
//Obtaining Polyphase Filter Coefficients from hn
p = zeros(I,M/I);
for k = 1:I
for n = 1:(length(hn)/I)
p(k,n) = hn(I*(n-1)+k);
end
end
disp('The Polyphase Interpolator for I =5 are:')
p
figure
plot(fr,hm)
xlabel('Normalized Digital Frequency fr');
ylabel('Magnitude');
title('Frequency Response of FIR LPF using REMEZ algorithm M=61')
figure
plot(.5*(0:255)/256,20*log10(frmag(hn,256)));
xlabel('Normalized Digital Frequency fr');
ylabel('Magnitude in dB');
title('Frequency Response of INTERPOLATOR(I=5) using REMEZ algorithm M=30')
|