summaryrefslogtreecommitdiff
path: root/149/CH23/EX23.13/ex13.sce
blob: ccac5eab7304b21dfd2fd422e8a58f2229013d86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
clear
clc
disp('the first row of A denotes the corresponding I.R. of students ')
A(1,:)=[105 104 102 101 100 99 98 96 93 92];
disp('the second row denotes the corresponding deviation of I.R.')
for i=1:10
  A(2,i)=A(1,i)-99;
end
disp('the third row denotes the square of corresponding deviation of I.R. ')
for i=1:10
  A(3,i)=A(2,i)^2;
end
disp('the fourth row denotes the corresponding  E.R. of students ')
  A(4,:)=[101 103 100 98 95 96 104 92 97 94];
disp('the fifth row denotes the corresponding deviation of E.R. ')
for i=1:10
  A(5,i)=A(4,i)-98;
end
disp('the sixth row denotes the square of corresponding deviation of E.R. ')
for i=1:10
  A(6,i)=A(5,i)^2;
end
disp('the seventh row denotes the product of the two corresponding deviations ')
for i=1:10
  A(7,i)=A(2,i)*A(5,i);
end
A
a=0;
disp('the sum of elements of  first row=a')
for i=1:10
  a=a+A(1,i);
end
a
b=0;
disp('the sum of elements of  second row=b')
for i=1:10
  b=b+A(2,i);
end
b
c=0;
disp('the sum of elements of  third  row=c')
for i=1:10
  c=c+A(3,i);
end
c
d=0;
disp('the sum of elements of  fourth row=d')
for i=1:10
  d=d+A(4,i);
end
d
e=0;
disp('the sum of elements of  fifth row=e')
for i=1:10
  e=e+A(5,i);
end
e
f=0;
disp('the sum of elements of  sixth row=d')
for i=1:10
  f=f+A(6,i);
end
f
g=0;
disp('the sum of elements of  seventh row=d')
for i=1:10
  g=g+A(7,i);
end
g
disp('coefficient of correlation=')
g/(c*f)^0.5