MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Nonautonomous ODEs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg72750] Re: Nonautonomous ODEs
  • From: dh <dh at metrohm.ch>
  • Date: Wed, 17 Jan 2007 07:28:56 -0500 (EST)
  • Organization: hispeed.ch
  • References: <eoht6m$puv$1@smc.vnet.net>


Hi Virgil,

use "Piecewise". E.g. F[t_] := Piecewise[{{1, t < 6}, {0, True}}, 0];

Daniel



Virgil Stokes wrote:

> 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

> 



  • Prev by Date: Decision tree algorithm
  • Next by Date: Re: Convolution Integral
  • Previous by thread: Nonautonomous ODEs
  • Next by thread: Re: Nonautonomous ODEs