%centrum
A = [0 -1; 1 0];
%nyereg
A = [1 0; 0 -1];%[0 1; 1 0]; % [-3 0; 0 2]; %A = [1 1; 4 -2]; s.v [1 1] és [1 -4]
%stabli spirál
A = [0 -1; 1 -1];
%stabil csomó
A = [0 -1; 1 -3];
%stabil spirál-csomó átmenet
A = [0 -1; 1 -1.9];

%instabil spirál
A = [0 -1; 1 1];
%instabil csomó
A = [0 -1; 1 3];

x = -5:1:5;
y = -5:1:5;
K = 500;
sz=1;
figure;
for a = -3:0.25:3%-12:0.25:-7%
    A = [0 -1; 1 a]%[4 1; a -2];%
   
se=eig(A)

 n=1;
fix = zeros(K,length(x)*length(y));
fiy = zeros(K,length(x)*length(y));
for i = 1:length(x)
    for j = 1:length(y)
        [t,fi] = ode45(@(t,y)elemi(t,y,A), linspace(0,5,K), [x(i) y(j)]);
        fix(:,n) = fi(:,1);
        fiy(:,n) = fi(:,2);
        n = n+1;
    end
end

plot(fix,fiy);
hold on;
[X Y] = meshgrid(x,y);
plot(X,Y,'x');
xlim([2*min(x) 2*max(x)]);
ylim([2*min(y) 2*max(y)]);
xlabel(['sajátértékek: ', num2str(se(1)), ', ', num2str(se(2))]);
hold off

waitforbuttonpress;
%pause(0.1)
end