MathGroup Archive 2007

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

Search the Archive

Re: Nonautonomous ODEs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg72741] Re: [mg72701] Nonautonomous ODEs
  • From: "Josef Otta" <josef.otta at gmail.com>
  • Date: Wed, 17 Jan 2007 06:52:46 -0500 (EST)

Hi Virgil,

You can use this approach for solving your problem:

a = 36;
b = 12;
c = 145;
t0 = 0; tmax = 20;

jumps = Flatten[
    Table[{{1, (i <
      x < i + 0.3)}, {0, (i + 0.3 <= x < i + 1)}}, {i, 0, tmax - 1}], 1];
F[x_] := Piecewise[jumps]

eqn = a x''[t] + b x'[t] + c x[t] == F[t];

Plot[f[t], {t, t0, tmax}]

soln = NDSolve[{eqn, x[0] == 0, x'[0] == 0}, x[t], {t, t0, tmax}];
Plot[Evaluate[x[t] /. soln], {t, t0, tmax}];

I hope, that it will solve your problem.


Best regards,
Josef Otta
http://home.zcu.cz/~jotta


2007/1/16, Virgil Stokes <vs at it.uu.se>:
>
> 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: Re: Convolution Integral
  • Next by Date: Re: Difficulties with Complex-Modulus Series
  • Previous by thread: Re: Nonautonomous ODEs
  • Next by thread: Font Problem