CJamie

exp2

Oct 11th, 2021
1,189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
MatLab 1.08 KB | None | 0 0
  1. % %PLOT UNIT STEP FUNCTION
  2. t=[-10:1:10];
  3. us=(t>=0);
  4. subplot(2,2,1);
  5. plot(t,us);
  6. % plot(t,us);
  7. xlabel('Values of t');                     %FOR LABELING X AND Y
  8. ylabel('Amplitude x(t)');
  9. title('unit step-101915122');
  10. %
  11. % %PLOT UNIT IMPULSE FUNCTION
  12. t=[-10:1:10];
  13. usi=(t==0);
  14. subplot(2,2,3);
  15. plot(t,usi);
  16. xlabel('Values of t');                     %FOR LABELING X AND Y
  17. ylabel('Amplitude x(t)');
  18. title('uit impulse 101915122');
  19. %
  20. % %PLOT UNIT STEP FUNCTION
  21. t=[-10:1:10];
  22. us=(t>=0);                                 %BY DEFAULT VALUE IS 1
  23. subplot(2,2,2);
  24. stem(t,us);
  25. stem(t,us);
  26. xlabel('Values of n');                     %FOR LABELING X AND Y
  27. ylabel('Amplitude x(n)');
  28. %
  29. % %PLOT UNIT IMPULSE FUNCTION
  30. t=[-10:1:10];
  31. usi=(t==0);
  32. subplot(2,2,4);
  33. stem(t,usi);
  34. xlabel('Values of n');                     %FOR LABELING X AND Y
  35. ylabel('Amplitude x(n)');
  36.  
  37. for x=-10:1:10
  38. if x>=0;
  39.     a=1;
  40.     hold on;
  41. else
  42.     a=-1;
  43.     hold on;
  44. end
  45. stem(x,a);
  46. xlabel('Values of n');                     %FOR LABELING X AND Y
  47. ylabel('Amplitude x(n)');
  48. title('signum 101915122');
  49. end
Advertisement
Add Comment
Please, Sign In to add comment