Community Tip - Visit the PTCooler (the community lounge) to get to know your fellow community members and check out some of Dale's Friday Humor posts! X
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)'
Solved! Go to Solution.
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
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!