Dang Manh Truong
Dang Manh Truong

Reputation: 656

Solving a pair of real (and interwined) equations

I have a first-order difference equation: y[n] = z0 * [n-1] + x[n] (2-3). Usually what we would do is apply the z-transform, then use the "filter" function. But my teacher wants to do it differently:

In the first-order difference equation (2-3), let yR[n] and yI[n] denote the real and imaginary parts of y[n]. Write a pair of real-valued difference equations expressing yR[n] and yI[n] in terms of yR[n-1], yI[n-1], x[n], and r, cos m, and sin m

(I forgot to mention, x[n]=G*dirac[n] where G is a complex constant, which is where r, cos m and sin m came from).

Here is my result (this is the best I could think of):

yR[n]=r(yR[n-1]cosm - yI[n-1]sinm) + xR[n]
yI[n]=r(yI[n-1]cosm + yR[n-1]sinm) + xI[n]

Then the next question is:

Write a MATLAB program to implement this pair of real equations, and use this prorgam to generate the impulse response of equation (2-3) for r=1/2 and m=0, and m=pi/4. For these 2 cases, plot the real part of the impulse responses obtained. Compare to the real part of the output from the complex recursion (2-3)

What I don't understand is just how i can do this besides applying z-transform and then use the "filter" function. I have looked up on the web, and there was something about the state-space form, but I don't know if it's relevant or not. Also I'm not looking to have the solution handed to me on a silver platter, I just want to know how to work it out. Thank you very much!

Upvotes: 0

Views: 60

Answers (1)

PearsonArtPhoto
PearsonArtPhoto

Reputation: 39698

You are on the right track. For a digital system, such as you have, you simply set the initial input, and run the program. There is no need to do anything fancy, you are very much overthinking the problem. In other words, for a simple function, you could do this:

f(0)=1;
f(n)=a*f(n-1);

Essentially for this you would loop for some range (Maybe 20 points), where f(n) looks at the previous function.

For your function, I suspect you simply set the real part (yR[0]) to 1, yI[0]=0, and run it for a while.

I know Matlab is 1 based, so you probably want to actually set the first value to 1, but the same principal applies.

Upvotes: 0

Related Questions