I want to simulate the behavior of this circuit in Maltab:

So 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:
/Code
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');
/Code
RL is a Load connected at the Vout node.

So 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:
/Code
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');
/Code
RL is a Load connected at the Vout node.