Shekhar777

MATLAB LAB1 EX1

Aug 1st, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.61 KB | None | 0 0
  1. Exercise 1 Write a MATLAB program for generation and plot of following basic signals over indicated
  2. interval
  3. • Unit impulse
  4.  
  5. δ[n], −5 ≤ n ≤ 5
  6.  
  7. • Unit step
  8.  
  9. u[n], −5 ≤ n ≤ 7
  10. Use stem to create your plots, and be sure to appropriately label your axes.
  11.  
  12. code
  13.  
  14. clc
  15. close all
  16. clear all
  17. n=-5:1:5;
  18. y=[ones(1,5),zeros(1,1),ones(1,5)];
  19. subplot(1,3,1)
  20. stem(n,y)
  21. hold on
  22. xlabel('n')
  23. ylabel('\delta[n]')
  24. title('Discrete-time unit impulse function ARHAN SHEKHAR')
  25. x=-5:1:5;
  26. t=[zeros(1,5),ones(1,1),zeros(1,5)];
  27. subplot(1,3,2)
  28. stem(x,t)
  29. hold on
  30. z=-5:1:5;
  31. r=[zeros(1,5),1,ones(1,5)];
  32. subplot(1,3,3)
  33. stem(z,r)
Add Comment
Please, Sign In to add comment