MathGroup Archive 1992

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

Search the Archive

Plotting interpolating functions

  • To: mathgroup at yoda.physics.unc.edu
  • Subject: Plotting interpolating functions
  • From: tim at math.earlham.edu (Tim McLarnan)
  • Date: Thu, 8 Oct 92 14:09:27 EST

This is probably silly, but,

For an applied math class, I'd like to plot together a function
giving the external force on a damped oscillator, and the solution to
the oscillator's motion.  I understand that the way to plot the
numerical solution is to do something like

Plot[Evaluate[y[t] /.NDSolve[{y''[t]+(1/2)y'[t]+y[t] == Sin[t],
                        y[0]==0, y'[0]==0}, y, {t,0,20}]],  {t,0,20}]

I therefore assumed that one could plot this function together with
the driving function Sin[t] by saying something like

Plot[{Sin[t], Evaluate[y[t]/.NDSolve[{y''[t]+(1/2)y'[t]+y[t]==Sin[t],
                        y[0]==0, y'[0]==0}, y, {t,0,20}]]}, {t,0,20}]

This and all attempts like it end in a blizzard of error messages.
What am I doing wrong?

(This is with Mma 2.1 on a NeXT.)
---
Tim McLarnan  tim at math.earlham.edu
Dept. of Mathematics, Earlham College, Richmond, IN 47374






  • Prev by Date: Re: Loop problem
  • Next by Date: Replace
  • Previous by thread: quaternions
  • Next by thread: Replace