cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Did you get an answer that solved your problem? Please mark it as an Accepted Solution so others with the same problem can find the answer easily. X

ODESOLVE: Access to differential of state variable

kkumar
1-Newbie

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

1 ACCEPTED SOLUTION

Accepted Solutions

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

View solution in original post

4 REPLIES 4
RichardJ
19-Tanzanite
(To:kkumar)

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

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.

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

Worked perfectly! Thanks!

Top Tags