CJamie

exp1

Oct 11th, 2021
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.43 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 continous 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('unit impulse continous 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. title('unit step discrete 101915122');
  29. %
  30. % %PLOT UNIT IMPULSE FUNCTION
  31. t=[-10:1:10];
  32. usi=(t==0);
  33. subplot(2,2,4);
  34. stem(t,usi);
  35. xlabel('Values of n'); %FOR LABELING X AND Y
  36. ylabel('Amplitude x(n)');
  37. title('unit impulse discrete-101915122');
  38.  
  39. for x=-10:1:10
  40. if x>=0;
  41. a=1;
  42. hold on;
  43. else
  44. a=-1;
  45. hold on;
  46. end
  47. stem(x,a);
  48. xlabel('Values of n'); %FOR LABELING X AND Y
  49. ylabel('Amplitude x(n)');
  50. title('signum discrete 101915122');
  51. end
  52.  
  53. 1b
  54. %
  55. t=-2:0.01:2;
  56. f=3;
  57. duty1=25;
  58. duty2=50;
  59. duty3=75;
  60. x=square(2*pi*f*t, duty1);
  61. y=square(2*pi*f*t, duty2);
  62. z=square(2*pi*f*t, duty3);
  63.  
  64. subplot(3,2,1)
  65. stem(t,x);
  66. title('Discrete Square Wave, duty cycle=25');
  67. xlabel('n');
  68. ylabel('x(n)');
  69. grid on;
  70. subplot(3,2,2)
  71. plot(t,x);
  72. title('Continuous Square Wave, duty cycle=25(101915122)');
  73. xlabel('t');
  74. ylabel('x(t)');
  75. grid on;
  76.  
  77.  
  78. subplot(3,2,3)
  79. stem(t,y);
  80. title('Discrete Square Wave ,duty cycle=50 ');
  81. xlabel('n');
  82. ylabel('y(n)');
  83. grid on;
  84. subplot(3,2,4)
  85. plot(t,y);
  86. title('Continuous Square Wave, duty cycle=50 (101915122)');
  87. xlabel('t');
  88. ylabel('y(t)');
  89. grid on;
  90.  
  91.  
  92. subplot(3,2,5)
  93. stem(t,z);
  94. title('Discrete Square Wave, duty cycle=75 ');
  95. xlabel('n');
  96. ylabel('z(n)');
  97. grid on;
  98. subplot(3,2,6)
  99. plot(t,z);
  100. title('Continuous Square Wave, duty cycle=75 (101915122)');
  101. xlabel('t');
  102. ylabel('z(t)');
  103. grid on;
  104.  
  105. % 1c
  106.  
  107. a1=1;
  108. f1=1;
  109. p1=0;
  110. a2=2;
  111. f2=1;
  112. p2=pi;
  113. t=(-10:0.1:10);
  114.  
  115. x1=a1*(sin((2*pi*f1*t)+ p1));
  116. subplot(2,1,1);
  117. plot(t,x1);
  118. grid on;
  119. title('Sine Wave[a=1,f=1,p=0] (101915122)');
  120. xlabel('t');
  121. ylabel('t(x)');
  122. x2=a2*(sin((2*pi*f2*t)+ p2));
  123. subplot(2,1,2);
  124. plot(t,x2);
  125. grid on;
  126. title('Sine Wave[a=2,f=1,p=pi] (101915122)');
  127. xlabel('t');
  128. ylabel('t(x)');
  129.  
Advertisement
Add Comment
Please, Sign In to add comment