Can't find cycles in dynamical system

117 Views Asked by At

I do my homework and got stuck. Let my system is: $$ \left\{ \begin{array}{ll} \dot{x}=22x^2 + 30xy + 10y^2 + 34x + 20y + 1; \\ \dot{y}= -29x^2 - 41xy - 14y^2 - 58x - 34y - 2; \\ \end{array} \right. $$ I need to find a cycle. Using matlab I found 2 equilibrium points: $P_1 = (4.0981; -6.8301)$ with eigenvalues $E_1 = [-2.3148, 0.9488]$ and $P_2 = ( -1.0981,1.8301)$ with eigenvalues $E_2 = [0.1830 - 2.8570i ; 0.1830 + 2.8570i]$. So we need to check if the second point has a cycle. Here is my matlab code.

function [ ] = tp() 
x = sym('x');
y = sym('y');
t = sym('t');


F=[22*x^2+30*x*y+10*y^2+34*x+20*y+1; -29*x^2-41*x*y-14*y^2-58*x-34*y-2];
s = solve(F == 0, [x y], 'real', true);
r=[s.x,s.y]';
rd=double(r);

for i=1:size(rd,1)
    disp(rd(:,i));
end

J = jacobian(F, [x;y]);
disp(J);

for i=1:size(rd,1)
    lin_approx = subs(J, [x; y], r(:,i))
    D = eig(lin_approx);
    dd=double(D);

    disp(dd);
end



f=matlabFunction(F,'vars',{t,[x; y]});
   
N=400;
L=[0.1 ,1.2];

eq_point=rd(:,2);
arr=(1:N)/N*L(1);
step = 0.0001;

Vc=f(0,eq_point+[L(2-1)/2;0]);
DirV=sign(Vc(2));
FEv=@(t,y) FEvent(t,y,eq_point,DirV);


rho = Poincare(arr, step);

figure('NumberTitle', 'off', 'Name', 'plotting Poincaré app');
plot(arr,rho);
hold on;
grid on;
for j=1:length(rho)-1
    if rho(j)*rho(j+1)<0; break;  end
end

xc=(arr(j)+arr(j+1))/2;
plot(xc,0,'r.','LineWidth',2,'MarkerSize',16);

function rho = Poincare(Arr, step)
        Tsp = 0:step:50;

        opts = odeset('AbsTol', 1e-5, 'RelTol', 1e-5, 'Events', FEv, 'MaxStep', 0.01, 'InitialStep', 0.001);

        rho=zeros(size(Arr));
       
        for j=1:length(Arr)
            Pc=eq_point-[Arr(j);0];
            [~,Y] = ode45(f,Tsp,Pc,opts);
            rho(j)=Y(end,1)-Pc(1);
        end

end

function [Val,isT,Dir] = FEvent(t,y,y0,isG)
    Val=y(2)-y0(2);
    isT=(t>1e-3);
    Dir=isG;
end    

end

My Poincaré Application plot looks bizzare. Here it is: my strange poincaré appli Normally it should be a curve crossing x-axe like this (it's from my friend's variant): what it should be
So my guess is that somewhere i'm doing wrong, otherwise there is no cycle and it's too easy to be true. Any ideas are appreciated !