Guest User

Untitled

a guest
Jan 19th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. %%Part 1 Commutative
  2.  
  3. T=0.1;
  4. t1=-2:T:-1-T;
  5. t2=-1:T:0;t3=T:T:1;
  6. t4=1+T:T:2;
  7. t=[t1 t2 t3 t4];
  8. tf1=[t2 t3];
  9. tf2=[t2 t3];
  10. f1=[ones(1,11) ones(1,10)];
  11. f2=[t2+1 1-t3];
  12. f12=T*conv(f1,f2);
  13. f21=T*conv(f2,f1);
  14.  
  15. figure(1)
  16. plot(t, f12)
  17. grid on;
  18. title('Commutative')
  19. ylabel('pulse(t)*triangle(t)')
  20. xlabel('Time t')
  21.  
  22. figure(2)
  23. plot(t, f21)
  24. grid on;
  25. title('Commutative')
  26. ylabel('triangle(t)*pulse(t)')
  27. xlabel('Time t')
  28.  
  29. figure(3)
  30. plot(tf1, f1)
  31. grid on;
  32. title('Pulse')
  33. ylabel('pulse(t)')
  34. xlabel('Time t')
  35. axis([-1.1 1.1 0 1.1]);
  36.  
  37. figure(4)
  38. plot(tf2, f2)
  39. grid on;
  40. title('Triangle')
  41. ylabel('triangle(t)')
  42. xlabel('Time t')
  43.  
  44. %%Part 2
  45. %%a)
  46. %%
  47.  
  48. num=[1 5];
  49. den=[1 4 3];
  50. t=0:0.1:5;
  51. h=impulse(num,den,t);
  52. figure(5)
  53. plot(t,h)
  54. grid on;
  55. title('Impulse of function')
  56. ylabel('H(s)')
  57. xlabel('Time t')
  58. %%B)
  59.  
  60. f=ones(1,length(t));
  61. t=0:0.1:10;
  62. figure(6);
  63. plot(t, conv(f,h))
  64. grid on;
  65. title('Step Response')
  66. ylabel('Conv(f,h)')
  67. xlabel('Time t')
  68.  
  69. %%C)
  70. t=0:0.1:5;
  71. f=sin(2*t);
  72. t=0:0.1:10;
  73. figure(7);
  74. plot(t,conv(f,h))
  75. grid on;
  76. title('System zero-state response using sin(2t)')
  77. ylabel('conv(sin(2t),h)')
  78. xlabel('Time t')
Add Comment
Please, Sign In to add comment