|
微波仿真實驗Ⅱ
負載為RC串聯
%% Transmission line settings ′«êäÏßéèÖÃ
Vp = 3e8; %Phase velocity of the transmission line ′«êäÏßÏàËù
Z0 = 50; %Characteristic impedance of the line ′«êäÏßìØÕ÷×è¿1
Length = 3; %Length of the line (3m) Ïß3¤Îa3Ã×
T = 50e-9; %Simulation time, starting from 0, ending at T
%% Finite Difference Settings
dt = 0.1e-9; %Time step 2½½ø
N = round(T/dt); %Total number of time steps
time = [1:N]*dt; %Array of discrete time points
M = round(Length/Vp/dt); %Number of time steps taken by the signal to
%propagate through the entire transmission line
%% Source SettingsDÅoÅÔ′éèÖÃ
Rs = 50; %Source output resistance
Vs = zeros(N,1);
%%% Step function, step change at time t0
t0 = 5e-9; n0 = round(t0/dt); Vs(n0:N)=1.0;
%% Load Settings ¸oÔØéèÖÃ
C=2e-10; %Load impedance
ZL=60;
%% Time-domain Updating
Vi = zeros(N,1); %Initialization of Vi
Vr = zeros(N,1); %Initialization of Vr
for n = 1:M
Vi(n) = Vs(n)/(1+Rs/Z0);
Vr(n) = 0;
end
Vi(M+1) = (Vs(M+1)-Vr(1)*(1-Rs/Z0))/(1+Rs/Z0);
Vr(M+1) = ((Vi(1)+0)*(Z0*C-ZL*C-1)+Vr(M)*(Z0*C+ZL*C+1))/(-ZL*C+Z0*C+1);
for n = M+2:N
Vi(n) = (Vs(n)-Vr(n-M)*(1-Rs/Z0))/(1+Rs/Z0);
Vr(n) =((Vi(N-M)+Vi(N-M-1))*(Z0*C-ZL*C-1)+Vr(N-1)*(Z0*C+ZL*C+1))/(-ZL*C+Z0*C+1);
end
%c′«êäÏßéÏx′|μÄμçÑ1
x = 0.5; nx = round(x/Vp/dt);
Vx = [zeros(nx,1);Vi(1:N-nx)] + [zeros(M-nx,1);Vr(1:N-M+nx)];
plot(time*1e9, Vx); hold on; xlabel('Time(ns)'); ylabel('V(x=1)');
title('′«êäÏßéÏx=0.5′|μÄμçÑ12¨DÎ');
|
|