Nitin400

QUESTION- Function for Shifted Unit Step Sequence:

Jan 2nd, 2020
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.35 KB | None | 0 0
  1. u[n − n0] =
  2. 1, n ≥ n0
  3. 0, n < n0
  4. over the n1 ≤ n0 ≤ n2 interval.
  5. function [x,n] = stepseq(n0,n1,n2)
  6. % Generates x[n] = u[n − n0], n1 ≤ n ≤ n2
  7. n1 = -7
  8. n2 = 6
  9. n0 = input('Enter desire value for shift ')
  10. [z,v] = stepseq(n1,n0,n2)
  11. stem(v,z)
  12. function [y s] = stepseq(n1,n0,n2)
  13. x = n1:n2
  14. n3=-n1
  15. y = [zeros(1,n3) ones(1,n2+1)]
  16. s = x+n0
  17. end
Add Comment
Please, Sign In to add comment