Animate[
Manipulate[
ParametricPlot[ Evaluate[{x[t], v[t]} /.
Quiet @ NDSolve[
{x'[t] == v[t],
v'[t] == μ (1 - x[t]^2) v[t] - x[t] + A*Cos[ω*t],
x[0] == xv0[[1]], v[0] == xv0[[2]]}, {x[t], v[t]}, {t, 0, tt}]],
{t, 0, tt}, ImageSize -> {450, 450}, PlotRange -> 4,
AxesLabel -> {TraditionalForm[x[t]], TraditionalForm[v[t]]},
PlotStyle -> PointSize[.5]
],
{{μ, 0.75, "parameter μ"}, 0, 3, 0.01, Appearance -> "Labeled"},
{{ω, 0.75, "parameter ω"}, 0, 3, 0.01, Appearance -> "Labeled"},
{{A, 0.75, "parameter A"}, 0, 3, 0.01, Appearance -> "Labeled"},
{{xv0, {1, 1}}, {-4, -4}, {4, 4}, Locator}], {tt, 0, 200},
AnimationRate -> 3, AnimationRepetitions -> 3, AnimationRunning -> True
]
Answer
You have to set values which are dynamic in Manipulate
.
μ = .75; ω = .75; A = .075; xv0 = {1, 1};
Table pictures for different tt
:
sol = Quiet@NDSolve[{x'[t] == v[t], v'[t] == μ (1 - x[t]^2) v[t] - x[t] + A*Cos[ω*t],
x[0] == xv0[[1]], v[0] == xv0[[2]]
}, {x[t], v[t]}, {t, 0, 20}];
dat = Table[
ParametricPlot[Evaluate[{x[t], v[t]} /. sol, {t, 0, tt},
PlotRange -> 4, AxesLabel -> {x[t], v[t]}]
, {tt, .1, 20, .2}];
Create gif.
SetDirectory@NotebookDirectory[]
Export["gif.gif", dat]
Comments
Post a Comment