i=19;j=2;
q=[59 68 52 69 60 57 62 61 41 69 62 56 56 65 63 71 62 67 39;4 12 16 3 7 7 11 2 8 4 5 5 9 5 7 10 6 7 31];
r11=q(1,1:i);r12=q(2,1:i);
r=r11+r12;z=q'
qt=sum(z);n=sum(qt);
%qt=[1139 159];%n=1298;
r1=(1/n).*r;l=ones(size(r1));
%r2=l-r1;
q1=(1/n).*qt;
h=q1(1)*n.*r1;
g=q1(2)*n.*r1;
a=[h;g];d=q-a;
d2=d.^2;
f=d2./a;s=sum(f);
xx=sum(s)
gradedelibertate=(i-1)*(j-1)