Shekhar777

MATLAB LAB1 EX6(a,b)

Oct 24th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.98 KB | None | 0 0
  1. Exercise 6 a) Define a MATLAB vector nx to be the time indices −3 ≤ n ≤ 7 and the MATLAB vector
  2. x to be the values of the signal x[n] at those samples, where x[n] is given by
  3. x[n] = 2δ[n] + δ[n − 2] − δ[n − 3] + 3δ[n − 4].
  4. Plot this discrete-time sequence by typing stem(nx,x).
  5.  
  6. b) Define vectors z1 through z4 to represent the following discrete-time signals:
  7. z1[n] = x[n − 2]
  8. z2[n] = x[n + 1]
  9. z3[n] = x[−n]
  10. z4[n] = x[−n + 1]
  11. To do this, you should define z1 through z4 to be equal to x. The key is to define correctly the corresponding index vectors nz1 through nz4. First, you should figure out how the index of a given sample of x[n] changes when transforming to zi ,[n], i = 1, 2, 3, 4.
  12. t = -6:1:6
  13. x = [zeros(1,6) 2*ones(1,1) zeros(1,1) ones(1,1) -ones(1,1) 3*ones(1,1) zeros(1,2)]
  14. subplot(3,2,1)
  15. stem(t,x)
  16. z1 = t + 2
  17. subplot(3,2,2)
  18. stem(z1,x)
  19. z2 = t - 1
  20. subplot(3,2,3)
  21. stem(z2,x)
  22. z3 = -t
  23. subplot(3,2,4)
  24. stem(z3,x)
  25. z4 = -t - 1
  26. subplot(3,2,5)
  27. stem(z4,x)
Add Comment
Please, Sign In to add comment