Differential Equations Systems with an PWM switch.

2 次查看(过去 30 天)
I want to simulate the behavior of this circuit:
I have this ODE System.
Where u is a PWM function with Duty Cylce D so u would be [1,0] because the circuits changes its topology when u is 1 or u because of the Switch (SW).
I want to simulate it in both modes at the same time. Is there any way of doing it? Here is my code:
E=input('Input the value of Source: ');
L=input('Input the value of Inductance: ');
C=input('Input the value of Capacitor: ');
RL=input('Input the value of Load: ');
u=input('Input the value of U: ');
syms i(t) v(t)
ode1 = diff(i) == -((1-u)/L).*v + E/L;
ode2 = diff(v) == (1-u)/C.*i - v/(RL*C);
cond1 = i(0) == 0;
cond2 = v(0) == 0;
conds = [cond1; cond2];
[iSol(t), vSol(t)] = dsolve(odes,conds);
ezplot(iSol);
hold on;
ezplot(vSol);
grid on;
legend('iSol','vSol','Location','best');
I would appreciate every advice for this. Thanks!

回答(0 个)

社区

更多回答在  Power Electronics Control

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by