|
微波仿真實驗
負載為純電感
%% 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ÔØéèÖÃ
L=2e-7; %Load impedance
%% 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) = ((L*Vi(1)+L*Vr(M))/(dt*Z0)-(Vi(1)+Vr(1))/2)*2*dt*Z0/(2*L+dt*Z0);
for n = M+2:N
Vi(n) = (Vs(n)-Vr(n-M)*(1-Rs/Z0))/(1+Rs/Z0);
Vr(n) = ((L*Vi(N-M)-L*Vi(N-M-1)+L*Vr(N-1))/(dt*Z0)-(Vi(N-M)+Vi(N-M-1)+Vr(N-1))/2)*2*dt*Z0/(2*L+dt*Z0);
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Î');
|
|