There is a system of differential equations:
Then, call the limit cycle the projection of the phase trajectory onto the plane in a pairwise combination of state variables ($x-y,y-z,x-z$).
where $x,y,z$ - state variables, $a,b,c$ - constants.
Is it possible to use Mathematica to estimate the amplitude and frequency of the limit cycle? (it is possible by approximate numerical methods, most importantly, not graphical).
I did like this: 1. Using NDSolve, I solve the system of differential equations numerically.
s = NDSolve[{x'[t] == -3 (x[t] - y[t]),
y'[t] == -x[t] z[t] + 26.5 x[t] - y[t], z'[t] == x[t] y[t] - z[t],
x[0] == z[0] == 0.1, y[0] == 0.25}, {x, y, z}, {t, 0, 400}]
Using ParametricPlot, I build a phase plane for a pairwise combination of state variables (see Figure 1 for an $x-y$ pair).
ParametricPlot[Evaluate[{x[t], y[t]} /. First[%]], {t, 0, 100}]
Using the Plot command, I build a graph for the state variable in time and try to estimate the frequency of the alternating signal from the graph. (see Figure 1 for an $x$ variable).
Plot[Evaluate[x[t] /. s], {t, 0, 100}]
EDIT:
After several hours of calculations and on the advice of one of the users, I applied data sampling and Fourier expansion with the construction of a frequency spectrum.
xsol[t_] := x[t] /. s[[1]]
xdis = Table[xsol[i], {i, 0, 100, 0.1}];
ListPlot[xdis]
fft = Fourier[xdis, FourierParameters -> {1, -1}];
ListLinePlot[shortFFT = Abs[fft[[5 ;; 400]]], PlotRange -> All]
f = Abs[Fourier[xdis]];
peaksize = Last[TakeLargest[f, 2]];
peaks = Flatten[Position[f, i_ /; i >= peaksize]];
pos = First[peaks];
Show[ListPlot[f], Graphics[{Red, Point[{pos, f[[pos]]}]}],
PlotRange -> All]
n = 100/0.1 + 1;
fr = Abs[Fourier[xdis Exp[2 Pi I (pos - 2) N[Range[0, n - 1]]/n],
FourierParameters -> {0, 2/n}]];
frpos = Position[fr, Max[fr]][[1, 1]]
Show[ListPlot[fr], Graphics[{Red, Point[{frpos, fr[[frpos]]}]}],
PlotRange -> All]
N[n/(pos - 2 + 2 (frpos - 1)/n)]
Fourier - > Applications - > Frequency Identification
This code gives an estimate of a period of ~ 564 sec and a frequency of 1 / T ~ 0.002 Hz. Which, of course, does not look like the results of NDSolve.
EDIT №2:
There is my code for Lorenz System. Nothing unusual, only classical continuous Fourier series.
In[49]:= pars = {n = 15, T = 20, \[Omega] = 2 Pi/T}
Out[49]= {15, 20, \[Pi]/10}
In[61]:= s =
NDSolve[{x'[t] == -3 (x[t] - y[t]),
y'[t] == -x[t] z[t] + 26.5 x[t] - y[t], z'[t] == x[t] y[t] - z[t],
x[0] == z[0] == 0.1, y[0] == 0.25}, {x, y, z}, {t, 0, 20}]
In[66]:= Plot[Evaluate[x[t] /. s], {t, 0, T}, PlotRange -> Full]
In[67]:= ifun = First[x /. s]
In[68]:= a0 = 2/T NIntegrate[ifun[t], {t, 0, T}]
Out[68]= -4.74859
In[69]:= f =
a0/2 + Sum[
2/T NIntegrate[
ifun[t] Cos[\[Omega] k t], {t, 0, T}] Cos[\[Omega] k t] +
2/T NIntegrate[
ifun[t] Sin[\[Omega] k t], {t, 0, T}] Sin[\[Omega] k t], {k, 1,
n}];
In[70]:= Plot[{ifun[t], f}, {t, 0, T}, PlotRange -> Full]
QUESTION: Is it possible to speed up this code, for example, apply a faster algorithm of numerical integration?
NDSolve
etc. If you give people something to start from, they are much more likely to help. If you have a starting point, even just the equations formatted in MMA format rather than having to type them back in, please share it by editing the question. In this case, please share theNDSolve
and theParametricPlot
, together with any definition of constants you used, etc. $\endgroup$Fourier
on a (large) discrete equi-spaced sample set might be useful here? $\endgroup$