Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % general settings, which can be changed
- L = 1; %length of transmission, in [m]
- Zc = 100; %transmission's impedance, in [ohm]
- vp = 3e8; %transmission's waves' speed, in [m/s]
- RG = 140; %source's impedance, in [ohm]
- RL = 150; %end of transmission's impedance, in [ohm]
- gammaL = (RL-Zc)/(RL+Zc);
- gammaG = (RG-Zc)/(RG+Zc);
- %amount of time the simulation runs, in [s]
- %i have also used the vg function to create the cos source.
- %b.
- %creating time vector
- I_idodim=zeros(4,1000);
- V_idodim=zeros(4,1000);
- Iss_Mat=zeros(4,1000);
- Vss_Mat=zeros(4,1000);
- Time_Mat=zeros(4,1000);
- Time_Mat(1,:)=linspace(0,10*L/vp,1000);
- Time_Mat(2,:)=linspace(0,L/vp,1000);
- Time_Mat(3,:)=linspace(3*L/vp,4*L/vp,1000);
- Time_Mat(4,:)=linspace(9*L/vp,10*L/vp,1000);
- Z = L/2;
- %V = zeros(1,1000);
- %I = zeros(1,1000);
- for p=1:4
- V_temp = zeros(1,1000);
- I_temp = zeros(1,1000);
- for k = 0:4
- V_temp = (power(gammaG,k)*power(gammaL,k)).*(Zc/(Zc+RG)).*vg(Time_Mat(p,:)-(2*k*(L/vp))-(Z/vp))+ ...
- (power(gammaG,k)*power(gammaL,k+1))*(Zc/(Zc+RG)).*vg(Time_Mat(p,:)-(2*(k+1)*(L/vp))+(Z/vp));
- I_temp = (1/Zc)*(power(gammaG,k)*power(gammaL,k)).*(Zc/(Zc+RG)).*vg(Time_Mat(p,:)-(2*k*(L/vp))-(Z/vp))- ...
- (1/Zc)*(power(gammaG,k)*power(gammaL,k+1))*(Zc/(Zc+RG)).*vg(Time_Mat(p,:)-(2*(k+1)*(L/vp))+(Z/vp));
- V_idodim(p,:) = V_idodim(p,:) + V_temp;
- I_idodim(p,:)=I_idodim(p,:)+I_temp;
- end
- end
- for p=1:4
- 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);
- Iss_Mat(p,:)=Vss_Mat(p,:)/Zc;
- end
- figure(1)
- plot(Time_Mat(1,:),V_idodim(1,:),'color','b');
- title('V Echo Series(t,-L/2) when 0<t<10T');
- xlabel('t[s]');
- ylabel('V[v]');
- figure(2)
- plot(Time_Mat(1,:),I_idodim(1,:),'color','r');
- title('I Echo Series(t,-L/2) when 0<t<10T');
- xlabel('t[s]');
- ylabel('I[A]');
- figure(3)
- plot(Time_Mat(1,:),Vss_Mat(1,:),'color','b');
- title('V Steady State(t,-L/2) when 0<t<10T');
- xlabel('t[s]');
- ylabel('V[v]');
- figure(4)
- plot(Time_Mat(1,:),Iss_Mat(1,:),'color','r');
- title('I Steady State(t,-L/2) when 0<t<10T');
- xlabel('t[s]');
- ylabel('I[A]');
- figure(5)
- plot(Time_Mat(2,:),V_idodim(2,:),'color','b');
- hold on;
- plot(Time_Mat(2,:),Vss_Mat(2,:),'color','r');
- title('V(t,-L/2) when 0<t<T');
- xlabel('t[s]');
- ylabel('V[v]');
- legend('V Echo Series','V Steady state')
- figure(6)
- plot(Time_Mat(3,:),V_idodim(3,:),'color','b');
- hold on;
- plot(Time_Mat(3,:),Vss_Mat(3,:),'color','r');
- title('V(t,-L/2) when 3T<t<4T');
- xlabel('t[s]');
- ylabel('V[v]');
- legend('V Echo Series','V Steady state')
- figure(7)
- plot(Time_Mat(4,:),V_idodim(4,:),'color','b');
- hold on;
- plot(Time_Mat(4,:),Vss_Mat(4,:),'color','r');
- title('V(t,-L/2) when 9T<t<10T');
- xlabel('t[s]');
- ylabel('V[v]');
- legend('V Echo Series','V Steady state')
- function y = vg(t)
- f=1e9;
- omega = 2*pi*f;
- y = sin(omega*t).*heaviside(t);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement