Nonautonomous ODEs
- To: mathgroup at smc.vnet.net
- Subject: [mg72701] Nonautonomous ODEs
- From: Virgil Stokes <vs at it.uu.se>
- Date: Tue, 16 Jan 2007 02:19:13 -0500 (EST)
I am having a problem with the numerical solution of non-autonomous ODEs. For example, I have the following code for a simple linear 2nd order ODE with a forcing function, F[t_] Clear[x,t] a = 36; b = 12; c = 145; t0=0; tmax = 20; eqn := a x''[t] + b x'[t] + c x[t] == F[t] F[t_] := 100 Exp[-t/6]Cos[2 t]; The following code gives its analytical solution and a plot of the solution for zero initial conditions, soln = DSolve[{eqn,x[0]==0,x'[0]==0},x[t],t]//Simplify truesoln = x[t]/.soln Plot[truesoln,{t,t0,tmax}]; The numerical solution and its plot can be obtained with, soln = NDSolve[{eqn,x[0]==0,x'[0]==0},x[t],{t,t0,tmax}]; Plot[Evaluate[x[t]/.soln],{t,t0,tmax}]; My problem, is that suppose the driving function is a sequence of unit amplitude rectangular pulses, each with width of 0.3 and having a period 1.0, then how can F[t_] be defined so that NDSolve can be used to obtain a numerical solution? --V. Stokes