Re: NDSolve and hybrid dynamics (Differential Algebraic Equation DAE)

*To*: mathgroup at smc.vnet.net*Subject*: [mg113544] Re: NDSolve and hybrid dynamics (Differential Algebraic Equation DAE)*From*: Ravi Balasubramanian <ravi.balasubramanian at yale.edu>*Date*: Tue, 2 Nov 2010 05:00:38 -0500 (EST)

Hello Oliver, Thanks for your suggestion. Unfortunately, a smoothing function would not be useful, since the system has binary states. I figured a way to do this is to include the f[x] function into the x'[t] equation such as x'[t] == f[x[t]] + Sin[t] (f[x] has only two states and no smoothing) and use NDSolve to solve for x[t]. This works. And then I can evaluate f[x[t]] using the NDSolve solution. Just to summarize this discussion: NDSolve does not support binary variables as part of the state? Ravi Oliver Ruebenkoenig wrote: > > > Ravi, > > would a smoothing function be useful? > > f[x_] := Which[ > x <= -1, 0, > -1 < x < 1, 1/2 + x (15/16 - x^2 (5/8 - 3/16 x^2)), > x >= 1, 1] + 1 > > Plot[f[(x - 0.1)/0.001], {x, -0.2, 0.2}] > > eqns = {x'[t] == y[t] + Sin[t], y[t] == f[t], x[-\[Pi]] == 1/2}; > sol = NDSolve[eqns, {x[t], y[t]}, {t, -5, 5}] > > Hope this helps, > > Oliver > > On Mon, 1 Nov 2010, Ravi Balasubramanian wrote: > >> Friends, >> >> I am trying to solve a hybrid dynamics problem using NDSolve. >> >> I am aware that I could use the event locator methods in NDSolve and >> manually take care of the transitions (set initial conditions etc). But >> my system is complicated, and I would have to do a lot of book-keeping. >> >> The following represents a simplified version of the problem. >> >> eqns = {x'[t] == y[t] + Sin[t], y[t] == If[t < 0.1, 1, 2], >> x[-Pi] == 1/2}; >> sol = NDSolve[eqns, {x[t], y[t]}, {t, -5, 5}] >> >> It is a first order differential equation in x[t], but it includes a >> y[t] variable that is discontinuous. There should be solution for this >> problem, but I get the following error message from NDSolve. >> >> LinearSolve::"nosol" : "Linear equation encountered that has no solution. >> >> The error is probably arising from the "If" condition. >> >> FYI, in my real system the y[t] variable is a Lagrange multiplier that >> is enforcing a constraint. Under certain conditions, that constraint is >> broken and the system transitions into another state. It will be great >> if this problem can be solved with NDSolve keeping track of the y[t] >> variable for me. Any suggestions greatly appreciated. >> >> Thanks! >> >> Ravi Balasubramanian >> Yale University >> >>