» x=[60 40 80 30 60 40 90 80]; » y=[10 5 10 6 3 6 12 7]; » z=[78.2 45.4 100.0 35.7 80.5 42.8 120.4 90.5]; » xx = sum(x.*x) xx = 32200 » yy = sum(y.*y) yy = 499 » zz = sum(z.*z) zz = 5.0449e+004 » xz = sum(x.*z) xz = 40197 » xy = sum(x.*y) xy = 3840 » yz = sum(z.*y) yz = 4.7998e+003 » mean(z) ans = 74.1875 » sum(z) ans = 593.5000 » sum(x) ans = 480 » sum(y) ans = 59 » A=[xx xy sum(x), xy yy sum(y), sum(x) sum(y) 8] A = Columns 1 through 6 32200 3840 480 3840 499 59 Columns 7 through 9 480 59 8 » A=[xx xy sum(x); xy yy sum(y); sum(x) sum(y) 8] A = 32200 3840 480 3840 499 59 480 59 8 » inv(A) ans = 0.0005 -0.0024 -0.0127 -0.0024 0.0267 -0.0556 -0.0127 -0.0556 1.2996 » b=[zx; zy; sum(z)] ??? Undefined function or variable 'zx'. » b=[xz; yz; sum(z)] b = 1.0e+004 * 4.0197 0.4800 0.0594 » inv(A)*b ans = 1.3067 0.4813 -7.7611