所以我正在尝试对下图中显示的系统进行建模。我之前在 ODE45 中使用 Matlab 建模,但由于某种原因,我不断收到以下代码的奇怪输出。我不确定是不是因为我输入了 if( (Vin - Vd - Vc)/Ll >= 0 ) 的条件,这有助于防止在二极管反向偏置时任何电流在二极管的错误方向上流动。
我试图附上图片,但我的代表不够高,真的吗?,所以我必须描述它。
source -> Inductor(Ll) -> diode -> Capacitor -> ground
|->Inductor(Lline)->resistor(Rf) -> ground
任何帮助表示赞赏!
function dy = ThreeLamp(t,y)
I1 = y(1);
I2 = y(2);
Vc = y(3);
Is = 1E-15; % these are parameters for the diode
n = 1.05;
Vt = .025;
D = 24; % this number is from 0 to 50
f = 100E3; % this is the frequency of the input waveform
Ll = 5E-7;
Lline = 5.3E-6;
C = 10E-6;
Rf = 10;
Vin = (465/2)*(6/266)*square(2*pi*f*t,D); % Input voltage waveform
if( Vin < 0 )
Vin = 0; % get rid of negative half cycle
end
%%
Vd = n*Vt*log(I1/Is + 1)/log(10); % This is the voltage across the diode
if( (Vin - Vd - Vc)/Ll >= 0 ) % Is the diode conducting when forward biased?
dy(1) = (Vin - Vd - Vc)/Ll; % Sounds good, what is the current?
else
dy(1) = 0; % force current to 0 when reversed biased
end
dy(2) = (Vc - I2*Rf)/Lline; % KCL for second loop
dy(3) = (I1 - I2)/C; % Voltage on cap
dy = dy'; % ODE45 likes output to be in columns
end
% [t, y] = ode45('ThreeLamp',[0 .001],[0 0 0 ]);