Advertisement
Guest User

Untitled

a guest
Nov 18th, 2017
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.92 KB | None | 0 0
  1. % general settings, which can be changed
  2. L = 1; %length of transmission, in [m]
  3. Zc = 100; %transmission's impedance, in [ohm]
  4. vp = 3e8; %transmission's waves' speed, in [m/s]
  5. RG = 140; %source's impedance, in [ohm]
  6. RL = 150; %end of transmission's impedance, in [ohm]
  7. gammaL = (RL-Zc)/(RL+Zc);
  8. gammaG = (RG-Zc)/(RG+Zc);
  9.  
  10. %amount of time the simulation runs, in [s]
  11.  
  12. %i have also used the vg function to create the cos source.
  13. %b.
  14. %creating time vector
  15. I_idodim=zeros(4,1000);
  16. V_idodim=zeros(4,1000);
  17. Iss_Mat=zeros(4,1000);
  18. Vss_Mat=zeros(4,1000);
  19. Time_Mat=zeros(4,1000);
  20. Time_Mat(1,:)=linspace(0,10*L/vp,1000);
  21. Time_Mat(2,:)=linspace(0,L/vp,1000);
  22. Time_Mat(3,:)=linspace(3*L/vp,4*L/vp,1000);
  23. Time_Mat(4,:)=linspace(9*L/vp,10*L/vp,1000);
  24. Z = L/2;
  25. %V = zeros(1,1000);
  26. %I = zeros(1,1000);
  27. for p=1:4
  28. V_temp = zeros(1,1000);
  29. I_temp = zeros(1,1000);
  30. for k = 0:4
  31. V_temp = (power(gammaG,k)*power(gammaL,k)).*(Zc/(Zc+RG)).*vg(Time_Mat(p,:)-(2*k*(L/vp))-(Z/vp))+ ...
  32. (power(gammaG,k)*power(gammaL,k+1))*(Zc/(Zc+RG)).*vg(Time_Mat(p,:)-(2*(k+1)*(L/vp))+(Z/vp));
  33. I_temp = (1/Zc)*(power(gammaG,k)*power(gammaL,k)).*(Zc/(Zc+RG)).*vg(Time_Mat(p,:)-(2*k*(L/vp))-(Z/vp))- ...
  34. (1/Zc)*(power(gammaG,k)*power(gammaL,k+1))*(Zc/(Zc+RG)).*vg(Time_Mat(p,:)-(2*(k+1)*(L/vp))+(Z/vp));
  35. V_idodim(p,:) = V_idodim(p,:) + V_temp;
  36. I_idodim(p,:)=I_idodim(p,:)+I_temp;
  37. end
  38. end
  39. for p=1:4
  40. Vss_Mat(p,:) = -0.19.*cos(6.28e9.*Time_Mat(p,:)-20.94.*Z)+0.35.*sin(6.28e9.*Time_Mat(p,:)-20.94.*Z)-0.038.*cos(6.28e9.*Time_Mat(p,:)+20.94.*Z)+0.07.*sin(6.28e9.*Time_Mat(p,:)+20.94.*Z);
  41. Iss_Mat(p,:)=Vss_Mat(p,:)/Zc;
  42. end
  43. figure(1)
  44. plot(Time_Mat(1,:),V_idodim(1,:),'color','b');
  45. title('V Echo Series(t,-L/2) when 0<t<10T');
  46. xlabel('t[s]');
  47. ylabel('V[v]');
  48. figure(2)
  49. plot(Time_Mat(1,:),I_idodim(1,:),'color','r');
  50. title('I Echo Series(t,-L/2) when 0<t<10T');
  51. xlabel('t[s]');
  52. ylabel('I[A]');
  53. figure(3)
  54. plot(Time_Mat(1,:),Vss_Mat(1,:),'color','b');
  55. title('V Steady State(t,-L/2) when 0<t<10T');
  56. xlabel('t[s]');
  57. ylabel('V[v]');
  58. figure(4)
  59. plot(Time_Mat(1,:),Iss_Mat(1,:),'color','r');
  60. title('I Steady State(t,-L/2) when 0<t<10T');
  61. xlabel('t[s]');
  62. ylabel('I[A]');
  63. figure(5)
  64. plot(Time_Mat(2,:),V_idodim(2,:),'color','b');
  65. hold on;
  66. plot(Time_Mat(2,:),Vss_Mat(2,:),'color','r');
  67. title('V(t,-L/2) when 0<t<T');
  68. xlabel('t[s]');
  69. ylabel('V[v]');
  70. legend('V Echo Series','V Steady state')
  71. figure(6)
  72. plot(Time_Mat(3,:),V_idodim(3,:),'color','b');
  73. hold on;
  74. plot(Time_Mat(3,:),Vss_Mat(3,:),'color','r');
  75. title('V(t,-L/2) when 3T<t<4T');
  76. xlabel('t[s]');
  77. ylabel('V[v]');
  78. legend('V Echo Series','V Steady state')
  79. figure(7)
  80. plot(Time_Mat(4,:),V_idodim(4,:),'color','b');
  81. hold on;
  82. plot(Time_Mat(4,:),Vss_Mat(4,:),'color','r');
  83. title('V(t,-L/2) when 9T<t<10T');
  84. xlabel('t[s]');
  85. ylabel('V[v]');
  86. legend('V Echo Series','V Steady state')
  87.  
  88. function y = vg(t)
  89. f=1e9;
  90. omega = 2*pi*f;
  91. y = sin(omega*t).*heaviside(t);
  92. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement