Question
Write a programthat implements a second-order IIR filter. You can use any programming language you want.Make sure you test your function with various inputs, and
Write a programthat implements a second-order IIR filter. You can use any programming language you want.Make sure you test your function with various inputs, and various filter coefficients.Recall thata second-order IIR filter is given by:
y[n] = a1*y[n-1] + a2*y[n-2] + b0*x[n] + b1*x[n-1] + b2*x[n-2]
Keep the feedback and feedforward coefficients in arrays a and b. Also, keep the input in array x and the output inarray y. You might want to print out the first N=20 outputs of the filter. Test your program with the following parameters:
float a[]={1,2,3}; /* a0, a1, a2 */
float b[]={1, 0.5, 0.3}; /* b0, b1, b2 */
float x[N]={2, 0, -1, 0.5, -2};
The output values generated by your program with these parameters should be:
2.00- 5.00- 8.10 - 4.05 -0.46- 1.06- 6.39- 3.51- 3.67-2.89- 2.55- 2.14- 1.84- 1.56- 1.33- 1.13- 0.97- 0.82- 0.70- 0.60
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started