Given a differential equation:
y[n] - 0.9y[n-1] + 0.81y[n-2] = x[n] - x[n-2]
a. Find the impulse response for h[n], n=0,1,2 using recursion.
b. Find the impulse response using MATLAB command filter.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I understand that this is homework, so I will try to give you guidelines without actually giving away the answer completely:
Using recursion
This is actually quite simple, because the differential equation contains the body of the recursive function almost entirely: y[n] = 0.9y[n-1] – 0.81y[n-2] + x[n] – x[n-2]
The parts in bold are actually the recursive calls! What you need to do is to build a function (let’s call it
func) that receivesxandn, and calculatesy[n]:Note that it’s pseudo-code, so you still have to check the edge cases and deal with the indexation (indices in MATLAB start with 1 and not 0!).
Using filters
The response of a digital filter is actually the y[n] that you’re looking for. As you probably know from lesson, the coefficients of that filter would be the coefficients specified in the differential equation. MATLAB has a built-in function
filterthat emulates just that, so if you write:You’d get an output vector which holds all the values of y[n].