i=19;j=2;
q=[51 51 47 53 41 43 48 38 36 57 54 37 39 51 53 59 48 53 26;12 29 21 19 26 21 25 25 13 16 13 24 26 19 17 22 20 21 44];
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)