X = load('mat1');
Y = load('mat2');

x = X(:)';
y = Y(:)';

plot(x,y,'.');
hold on % zadrzava prvi plot

xp = sum(x)/length(x); % prosecne vrednosti
yp = sum(y)/length(y);

plot(xp,yp,'o');

xsd = 2*sqrt(sum((x-xp).^2)/length(x)); % dupla standardna devijacije
ysd = 2*sqrt(sum((y-yp).^2)/length(x));

phi = (0:0.01:2*pi);
ex = xsd*cos(phi); %parametarska jednacina elipse
ey = ysd*sin(phi);

plot(ex+xp, ey+yp, '-');