Suppose a system is implemented with the difference equation: y(n) = x(n) + 2 x(n − 1) − 0.95 y(n − 1) Write your own Matlab function, mydiffeq, to implement this difference equation using a for loop. (Type help for to see how to use the for loop.) If the input signal is N -samples long (0 ≤ n ≤ N − 1), your program should find the first N sample of the output y(n) (0 ≤ n ≤ N − 1). Remember that Matlab indexing starts with 1, not 0, but don’t let this confuse you. Use x(−1) = 0 and y(−1) = 0. (a) Is this system linear? Use your Matlab function to confirm your answer: y1 = mydiffeq(x1) y2 = mydiffeq(x2) y3 = mydiffeq(x1+2*x2) Use any signals x1, x2 you like.
Hello I need help getting this to work in matlab. Im suppose to get this to show a plot but the code i have in the image is not working. Please help. THank you.
Difference Equations
Suppose a system is implemented with the difference equation:
y(n) = x(n) + 2 x(n − 1) − 0.95 y(n − 1)
Write your own Matlab function, mydiffeq, to implement this difference equation using a for loop. (Type help for to see how to use the for loop.) If the input signal is N -samples long (0 ≤ n ≤ N − 1), your program should find the first N sample of the output y(n) (0 ≤ n ≤ N − 1). Remember that Matlab indexing starts with 1, not 0, but don’t let this confuse
you.
Use x(−1) = 0 and y(−1) = 0.
(a) Is this system linear? Use your Matlab function to confirm your answer: y1 = mydiffeq(x1)
y2 = mydiffeq(x2)
y3 = mydiffeq(x1+2*x2)
Use any signals x1, x2 you like.
(b) Compute and plot the impulse response of this system. Use x = [1, zeros(1,100)]; as input.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images