How to calculate and build an instant phase in Mathematica

I need a graph of the instantaneous phase difference between the frequency drive and the non-linear generator that it controls. x [t] below is the instantaneous displacement of the oscillator, and plotx is the graph.

Thanks Carey

s =
 NDSolve[{x''[t] + x[t] - 0.167 x[t]^3 == 
    0.005 Cos[t - 0.5*0.0000652*t^2], x[0] == 0, x'[0] == 0}, 
  x, {t, 0, 3000}, MaxSteps -> 35000]

plotx = Plot[Evaluate[x[t] /. s], {t, 0, 3000}, PlotPoints -> 10000, 
  Frame -> {True, True, False, False}, FrameLabel -> {"t", "x"}, 
  FrameStyle -> Directive[FontSize -> 15], PlotLabel -> "(a)", 
  Axes -> False]
+3
source share
2 answers

(Answer, take 2)

You can get a reasonable approximation of the phase with

f[tt_?NumericQ] := -(ArcTan @@ ({x[t], x'[t]}/
    Sqrt[x[t]^2 + x'[t]^2]) /. s[[1]]) /. t -> tt

Here are a few stories. First we show driving and result together. This means that they are a little out of phase.

plotx2 = Plot[
  Evaluate[{x[t], Cos[t - 0.5*0.0000652*t^2]/5} /. s], {t, 0, 100}, 
  Frame -> {True, True, False, False}, FrameLabel -> {"t", "x"}]

enter image description here

Now we show the two phases together. This time I draw several times.

phaseangles = 
 Plot[{f[t], Mod[t - 0.5*0.0000652*t^2, 2*Pi, -Pi]}, {t, 100, 120}, 
  Frame -> {True, True, False, False}, FrameLabel -> {"t", "x"}]

enter image description here

Recently, phase differences have been shown.

phasediffs = 
 Plot[{f[t] - Mod[t - 0.5*0.0000652*t^2, 2*Pi, -Pi]}, {t, 100, 120}, 
  Frame -> {True, True, False, False}, FrameLabel -> {"t", "x"}]

enter image description here

Maybe I have something extra (the terms Mod [] become intrusive), but this should give an idea of ​​how to proceed.

Daniel Lichtblow Wolfram Research

+3

. Strogatz , . - , .

+1

Source: https://habr.com/ru/post/1792159/


All Articles