Preliminary C++ Program
Discussion
An FIR (Finite Impulse Response) filter can he represented by
N- 1
Y(n) = ∑ x (n-k) h(k)
K=0
Where N is the number of coefficients, h (k) is the impulse response of the filter
x(n-k) the input of the niter delayed k clock cycles
y (n) is the output of the filler, and x(m) = 0 for m < 0;
A given optimal equiripple FIR (Finite Impulse Response) filter has the following specification:
Sample rate: 10 kHz (0.0001 see / sample); Passband: 0 - 2.5 kHlz (Iowpass), 0.5 dB maximum ripple, Stophand: 3.0- 5 kHz, 50dB minimum attenuation
Using the Parks-Mcclellan program, we obtain the following impulse response values (scaled by 215'; ie, to get actual value, divide by 215).
h(0) = h(34) = 361.922 h(9) = h(25) = 812.822
h(1) = h(33) = 589.000 h(10) = h(24) = -934.419
h(2) = h(32) =- 52.556 h(11) = h(23)= -1082.725
h(3) = h(31) = -538.095 h(12) = h(22) = 1547.666
h(4) = h(30) = -58.657 h(13) = h(21) = 1083.109
h(5) = h(29) = 499A72 h(14) = h(20) = -3229.928
h(6) = h(28) = -251,531 h(15) = h(19) = -1275.738
h(7) = h(27) = -785.168 h(16) = h(18) = 10268.660
h(8) = h(26) = 381.999 h)(17) = h(17) = 17571.900
Courtesy: Dale Clover & John Della, Digital Signal Processing and Microcontroller, Motorola University, Prentice-Hall, 1999.
Step to follow-
1. Create three arrays x[600], h[600], and y[600]
2. Fill the x array with the 600 sample values of x(t) a-- 100 sin (4000 π t) for 0≤ t < 0.06 with rate of t = 0.0001 per sample. Note that the frequency for the sinewave is 2 kHz. The 600 sample values for the impulse function
3. Compute y[n] for 0≤ n< 600
4. Store the 600 sample values of x[n] in file filex and store the 600 sample values of y[n] in file filey.
5. Graph x[n] and y[n] on the same graph using Excel. Compare the amplitude of the two sinewaves x [n] and y[n].
Work to do
1. Repeat steps 1 to 5 for x(t) = 100 sin (4000 It t ) , frequency 2 kHz.
2. Repeat steps 1 to 5 for x(t) = 100 sin (6000 It t ), frequency 3 kHz.
3. Repeat steps 1 to 5 for x(t) = 100 sin (8000 it t ) frequency 4 kHz.
4. Compare the amplitudes of the two sinewaves x[n] and y[n] for frequencies 2 kHz, 3 kHz, and 4 kHz. Categorize the filter either as low pass filter, high pass filter, or hand-pass filter.