Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I'm having some difficulty plotting a phase space of a function f that exhibits time delay.

i.e.

s = NDSolve[{x'[t] == f[x[t - \[Tau]]], x[0] == 1 }, {x}, {t, 100}];
ParametricPlot[{x[t] /. s, x[t-\[Tau]] /. s}, PlotRange -> All]

i.e. how do I plot x(t-\[Tau]) vs x(t) ?

share|improve this question
    
You don't show any information on v[t]. –  yulinlinyu Dec 5 '12 at 5:19
    
apologies, those should all be x[t]. fixed! –  randomafk Dec 5 '12 at 5:26
    
And also no information on f[x[t]]. –  yulinlinyu Dec 5 '12 at 5:30
    
It's just a generic function. –  randomafk Dec 5 '12 at 5:34
    
Okay, no generic solution. –  yulinlinyu Dec 5 '12 at 5:36
show 1 more comment

1 Answer

up vote 4 down vote accepted

References:

The following examples where (1) s is defined as a function of a numeric argument $\tau$, and (2) ParametricPlot is supplied with the parameter argument ({t,0,10}) that it needs, work as you intended:

 ClearAll[s];
 f = Cos;
 s[\[Tau]_?NumericQ] :=   NDSolve[{x'[t] == f[x[t - \[Tau]]], x[0] == t}, {x},
  {t, 100}];
 Quiet@ParametricPlot[Evaluate[{ x[t - #] /. First@s[#], x[t] /. First@s[#]} & /@ 
    {1, 2, 3, 4}],  {t, 0, 100}, PlotRange -> All]

enter image description here

Another example with a non-constant initial function:

  ClearAll[s2]; 
  s2[\[Tau]_?NumericQ] := NDSolve[{x'[t] == f[x[t - \[Tau]]], 
        x[t /; t <= \[Tau]] == t}, {x}, {t, 100}]; 
  Quiet@ParametricPlot[ Evaluate[{x[t - #] /. First@s2[#], x[t] /. 
     First@s2[#]} & /@ {1, 2, 3, 4}], {t, 0, 100}, PlotRange -> All]

enter image description here

and, for the constant initial function in your example:

 ClearAll[s3];
 s3[\[Tau]_?NumericQ] := NDSolve[{x'[t] == f[x[t - \[Tau]]], x[0] == 0.},
   {x}, {t, 100}]; 
 Quiet@ ParametricPlot[Evaluate[{x[t - #] /. First@s3[#], x[t] /. 
    First@s3[#]} & /@ {1, 2, 3, 4}], {t, 0, 100}, PlotRange -> All]

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.