そこで、下の図に示すシステムをモデル化しようとしています。以前、Matlab を使用して ODE45 でモデル化したことがありますが、何らかの理由で、次のコードで奇妙な出力が得られます。逆バイアスされたときにダイオードの間違った方向に電流が流れるのを防ぐのに役立つ 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 ]);