Hello everyone,
I have a few Matlab problems for my class that I could use some help on. The problem is the following:
When I ran this it gave me the attached output. I also noticed it didnt give me the value at 0 as well. I was wondering if someone could help me figure out how to implement this recursively in Matlab, assuming what I have in incorrect. Thanks!
I have a few Matlab problems for my class that I could use some help on. The problem is the following:
Searching around it seemed to me like Matlab could not calculate the y[0] value because it didnt like the 0 index. I havent done Matlab in a while so I'm not sure if that is the case or not. To overcome this, I calculated the y[1] and y[2] values and used these in a for loop. My Matlab m file looked like this:Use MATLAB to recursively determine and plot the system output y[n] for 0 <= n <= 30 if the system is described by the difference equation
y[n] = 0.1y[n-1]+0.72y[n-2]+5x[n].
The initial conditions are y[-1] = 1 and y[-2] = -1, and the input is x[n] =d[n] (i.e., the unit impulse). Present the stem plot with labeled horizontal and vertical axes (i.e., n and y[n] respectively). Based on the stem plot, what can you conclude concerning the stability of the system?
Rich (BB code):
n=[1:30];
y(1) = 6.16;
y(2) = 8.77;
for m=3:30;
y(m)=0.1*y(m-1)+.72*y(m-2)+5;
end
stem(n,y,'o')
Attachments
-
29.5 KB Views: 120
Last edited: