Re: ParametricPlot Problem
- To: mathgroup at smc.vnet.net
- Subject: [mg54235] Re: [mg54217] ParametricPlot Problem
- From: "David Park" <djmp at earthlink.net>
- Date: Mon, 14 Feb 2005 00:57:51 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
James,
The basic problem is the NDSolve returns the solution inside two pairs of
brackets
{{ x -> ...}}
and when you make the substitution it leaves one pair of brackets and that
doesn't work for the parametrization. So select the inner solution as
follows. (You didn't give us a y function so I made one up.)
deqns = {x''[t] + 0.5x'[t] + x[t] + 0.1 x[t]^2 == Sin[0.1t], x[0] == 1,
x'[0] == 0};
dsol = NDSolve[deqns, x, {t, 0, 400}][[1,1]]
x -> InterpolatingFunction[{{0., 400.}}, <>]
ParametricPlot[{Evaluate[x[t] /. dsol],
Sin[2*Pi*(t/50)]}, {t, 0, 200},
PlotPoints -> 100,
Frame -> True,
ImageSize -> 400];
David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/
From: James [mailto:cannonjunk at hotmail.com]
To: mathgroup at smc.vnet.net
Hi,
I'm trying to do a Parametric Plot of a 2nd order differential
equation:
1. dee = x''[t] + 0.5 x'[t] + x[t] + 0.1 x[t]^2 == Sin[0.1t];
2. constraints = { x[0] == 1, x'[0] == 0};
3. sol = NDSolve[ {dee, constraints}, x[t], {t, 0, 400} ];
4. ParametricPlot[ {Evaluate[ x[t] /. sol], y [t]}, {t, 0, 200}]
but it keeps telling me
"ParametricPlot::pptr: "\!\({Evaluate[x[t] /. \[InvisibleSpace]sol]}\)
does \
not evaluate to a pair of real numbers at t = 8.333333333333334`*^-6."
etc.
This is despite the fact that it works if I do a straight "Plot" (ie, I
just remove the "Parametric" part of 4.)
If anyone can suggest how I might correct this problem I would
appreciate it a lot since I'm quite out of ideas.
Thanks,
James
--
Mathematica 5.0
UK