Thanks

function dcrl = inducwithE(t,i)

% function for RL circuit calculations

Vs=50;

E=30;

L=0.1;

R=1;

Z=E/L;

X = (Vs/L)-Z;

Y = i*R/L;

if t<0.7;

dcrl = X - Y;VT=Vs;

else 0.7<t<0.75;

dcrl=-Z-Y;

end

if t>0.75;

dcrl=Z-Y;

end

if t>1.4

dcrl = X - Y;

end

tspan=[0 2];

i0=0;

[t, i]=ode45('inducwithE',tspan,i0')