Skip to main content
1-Visitor
May 18, 2015
Solved

ODESOLVE: Access to differential of state variable

  • May 18, 2015
  • 4 replies
  • 2015 views

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

Best answer by AlanStevens

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

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

kkumar1-VisitorAuthor
1-Visitor
May 19, 2015

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.

19-Tanzanite
May 19, 2015

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

kkumar1-VisitorAuthor
1-Visitor
May 19, 2015

Worked perfectly! Thanks!