Skip to main content
1-Visitor
May 18, 2015 10:40 PM UTC
Solved

ODESOLVE: Access to differential of state variable

Hello,

I am using the ODESOLVE to simulate an RLC circuit. My states are my inductor current IL and capacitor voltage VC.

I setup equations to solve for d(IL)/dt, and d(VC)/dt, and used ODESOLVE to get the values. I now need access to the original differential variables....I need access to d(IL)/dt to get my inductor current. Any ideas on how to? In MATLAB I could setup a global variable, but I am unable to define variables that use my states in the solver block.

Screenshot of odesolver attached, I need access to IL(t)'

19-Tanzanite
May 19, 2015 7:18 AM UTC

Define ILCdot(Vc,ILc) := ... outside of (before) the solve block, then just have ILc`(t) = ILCdot(Vc,ILc) within the solve block. Then you can call ILCdot(Vc(t),ILc(t)) at any time after the solve block.

Alan

4 replies

19-Tanzanite
May 18, 2015 10:47 PM UTC

Unless I misunderstand your question, Odesolve has returned exactly what you are asking for. Odesolve returns a function, not values. I_sub_Lc is a function name that you can call for a given time (or times), I_sub_Lc(t).

Translate
kkumar1-VisitorAuthor
1-Visitor
May 19, 2015 7:33 PM UTC

Hi Richard,

I was looking for the function I_sub_Lc but also wanted access to its differential I_sub_Lc_dot which is used by the solver.

Translate
19-Tanzanite
May 19, 2015 7:18 AM UTC

Define ILCdot(Vc,ILc) := ... outside of (before) the solve block, then just have ILc`(t) = ILCdot(Vc,ILc) within the solve block. Then you can call ILCdot(Vc(t),ILc(t)) at any time after the solve block.

Alan

Translate
kkumar1-VisitorAuthor
1-Visitor
May 19, 2015 7:33 PM UTC

Worked perfectly! Thanks!

Translate