Differential Equations Systems with an PWM switch.

4 views (last 30 days)
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!

Answers (0)

Communities

More Answers in the  Power Electronics Control

Categories

Find more on Electrical Block Libraries in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!