Re: Differential Eq.
- To: mathgroup at smc.vnet.net
- Subject: [mg106534] Re: Differential Eq.
- From: dh <dh at metrohm.com>
- Date: Fri, 15 Jan 2010 03:21:44 -0500 (EST)
- References: <himsn6$j93$1@smc.vnet.net>
Hi Jamil, g only depends on x'. We therefore define it as a function with one parameter (== x'). It is convenient using a Piecewise function for this. Here is the code: =================================== b = 5; v = 0.2; u = 0.1; tmax = 1; g[der_?NumericQ] = Piecewise[{{b*v, der > v}, {b*(der - u), Abs[der - u] < v}, {-b*v, True}}]; eq = { x''[t] - x[t] + g[x'[t]] == 0, x[0] == 0, x'[0] == 0 }; sol = x /. NDSolve[eq, {x}, {t, 0, tmax}][[1]]; Plot[sol[t], {t, 0, tmax}, AxesLabel -> {"t", "x[t]"}] ParametricPlot[{sol[t], sol'[t]}, {t, 0, tmax}, AxesLabel -> {"x[t]", "x'[t]"}] ============================================= Daniel Jamil Ariai wrote: > Hi All, > > > > Can anybody kindly tell me how I can solve the following differential equation, with (x[0], x'[0]) = (0, 0): > > > > x''[t] -x[t] + g[t] = 0, > > > > where > > > > g[t] = b*v, for x'[t] > v, > > g[t] = b*(x'[t]-u), for Abs[x'[t]-u] < v, and > > g[t] = -b*v. > > > > Take b = 5, v = 0.2, and u = 0.1. Draw x[t] vs t, and x'[t] vs x[t]. > > > > Thanks. > > > > J. Ariai > >