I have analysed a RL circuit with freewheelind diode, switch and additional source. I have used ode solver which is called ode45 in matlab. This expression is [t, i]=ode45('inducwithE', tspan, i0'). There is three stages in that circuit and every last 'i' (current-this is the state variable) value for the previous stage becomes initial value for the following stages. But when I am using if statement for three different conditions I am always referring the expression ([t, i]=ode45('inducwithE', tspan, i0')). In that point 'i' becomes always '0'. How can I assing those initial values for second and third stages? Could anyone help me about it???(adsbygoogle = window.adsbygoogle || []).push({});

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')

**Physics Forums - The Fusion of Science and Community**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# RL Circuit with matlab

Can you offer guidance or do you also need help?

Draft saved
Draft deleted

Loading...

Similar Threads - Circuit matlab | Date |
---|---|

De facto standard file format for electronic circuits | Jan 14, 2016 |

Electrical circuit | Dec 27, 2015 |

MATLAB: How to add initial states to a circuit simulation | Apr 23, 2013 |

Circuit drawing and simulation program for a beginner | Apr 16, 2011 |

Question: Space Vector PWM in Matlab/Simulink & 5V-15V Interface circuit | Mar 7, 2007 |

**Physics Forums - The Fusion of Science and Community**