How to use a discretized controller with NDSolve?
- To: mathgroup at smc.vnet.net
- Subject: [mg105007] How to use a discretized controller with NDSolve?
- From: Joe Hays <hays.joe at gmail.com>
- Date: Tue, 17 Nov 2009 05:16:40 -0500 (EST)
Hello all, I thought I'd check to see if there is a better way to perform a calculation. I've been using NDSolve to determine the response of a system of nonlinear differential equations representing a controlled double pendulum. So, each pendulum has an associated input, say U[i]. The dynamics are discribed by continuous ODEs, however, my controller is discrete, meaning, every 'dt' seconds new updates are sent to each U[i]. Assuming I know what the desired list of U[i] updates are before hand... I've used the Piecewise function to create piecewise continuous functions representing each U[i] to inject into the double pendulum system of ODEs. This is not the way I would do this in other languages but given my somewhat primitive skills in Mathematica... this is what I came up with. My solutions appear to be correct so my question is motivated more to improve my Mathematica skills. Any thoughts or points are welcome. Thx. Joe