summaryrefslogtreecommitdiff
path: root/331/CH3/EX3.11/Example_3_11.sce
blob: 3363c479df4848b1439974e3cd0ad7160bf70845 (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
72
73
74
//Caption:Relationship between Mean, Median and Mode
//Example3.11
//Page48
clear;
clc;
X = [0,2;2,4;4,6;6,8;8,10;10,12;12,14;14,16;16,18];
f = [10,15,20,30,8,5,4,3,5];
cum_f = 0;
for i = 1:length(f)
    cum_f = cum_f+f(i);
    sigmaf(i) = cum_f;
end
N = cum_f; //total number of salesman
cen = N/2;
for  i = 1:length(f)
    if ((sigmaf(i)< cen) &(cen< sigmaf(i+1))) then
        L = X(i+1,1);
        Fre = f(i+1);
        F = sigmaf(i)
        C = diff(X(i+1,:));
    end
end
disp(L,'Lower limit of the median class L =')
disp(Fre,'Frequency of the Median class f =')
disp(F,'Cumulative frequency of the previous class F=')
disp(C,'Width of the class interval C=')
Median = L+(((N/2)-F)*C/Fre);
disp(Median,'Median of the travelling allowance of the salesman is Rs =')
disp('Crores')
[Maxf,i]= max(f);
f1 = abs(f(i)-f(i-1));//Absolute difference between freq. of the modal class and
//that of its immediately preceding class
f2 = abs(f(i)-f(i+1));//Absolute difference beween freq. of the modal class and 
//that of its immediately succeeding class
Mode = L+((f1/(f1+f2))*C); 
disp(Mode,'Mode of the annual revenues of the firms is =')
disp('crores')
Mean = (3*Median-Mode)/2;
disp(Mean,'Mean of the annual revenue of the firm is =')
disp('crores')
//Result
//Lower limit of the median class L =   
// 
//    6.  
// 
// Frequency of the Median class f =   
// 
//    30.  
// 
// Cumulative frequency of the previous class F=   
// 
//    45.  
// 
// Width of the class interval C=   
// 
//    2.  
// 
// Median of the travelling allowance of the salesman is Rs =   
// 
//    6.3333333  
// 
// Crores   
// 
// Mode of the annual revenues of the firms is =   
// 
//    6.625  
// 
// crores   
// 
// Mean of the annual revenue of the firm is =   
// 
//    6.1875  
// 
// crores