Advertisement
yepitszakaria

exp1a2

Aug 16th, 2022
1,285
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 0.86 KB | None | 0 0
  1. % Subplot-1: Unit sample sequence, where sample position, n= -(L+M) to (L+N).
  2.  
  3. a=-11;  %here L+M = 11 and L+N = 14
  4. b=14;
  5. n=a:b;
  6. y=[zeros(1,abs(a)),ones(1,1),zeros(1,b)];
  7. subplot(3,1,1);
  8. stem(n,y,'LineWidth',1,'Color','g');
  9. xlabel('Sample position');
  10. ylabel('Amplitude');
  11.  
  12. title('Unit impluse signal');
  13.  
  14. %Subplot-2: Unit step sequence, where sample position, n= -(L+M) to (L+N).
  15. a=-11;
  16. b=14;
  17. n=a:b;
  18. y=[zeros(1,abs(a)),ones(1,1),ones(1,b)];
  19. subplot(3,1,2);
  20. stem(n,y,'LineWidth',1,'Color','b');
  21. xlabel('Sample position');
  22. ylabel('Amplitude');
  23. title('Unit step sequence');
  24. % Subplot-3: Unit ramp sequence, where sample position, n= 0 to (L+M+N).
  25. n=0:16; % here L+M+N = 9+2+5 = 16;
  26. y=n;
  27. subplot(3,1,3);
  28. stem(n,y,'LineWidth',1 ,'Color','m');
  29. xlabel('Sample position');
  30. ylabel('Amplitude');
  31. title('Unit ramp sequence');
  32.  
  33.  
  34.                                
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement