Anda di halaman 1dari 2

Pengantar Statistik – Penyajian Data dan Distribusi Frekuensi

Source Code Menggunakan Matlab :
clc;
clf;
clear all;

a=importdata('data1.txt');
b=importdata('data3.txt');
min(a);
min(b);
c=[a b];
sort_data=sort(c(:));
ver_data=transpose(sort_data);

% nilai tepi
be = 16 :6: ceil(max(ver_data) / 2) * 2;

% absolute frequencies
af = histc(ver_data, be);
% frekuensi relatif
rf = af / sum(af);

%frekuensi kumulatif kurang dari
cumLT(1)=0;
for i=2:length(af)
cumLT(i)=cumLT(i-1)+af(i-1);
end

%frekuensi kumulatif lebih dari
cumGT(1)=length(sort_data);
temp1=0;
af_margin=length(af)+1;
for i=1:length(af)
temp1(i)=af(af_margin-i);
end
for i=2:length(af)
cumGT(i)=cumGT(i-1)-af(i-1);
end
%Table
f = figure('Position',[400 200 500 185]);
relfreq=rf*100;
col1=transpose(af);
col2=transpose(relfreq);
col3=transpose(cumLT);
col4=transpose(cumGT);
dat = [col1 col2 col3 col4];
cnames = {'Frekuensi','Frekuensi Relatif','Kumulatif Kurang
dari','Kumulatif Lebih dari'};
rnames = {'16-21','22-27','28-33','34-39','40-45','46-51','52-57','58-
63','64-69'};
uitable('Parent',f,'Data',dat,'ColumnName',cnames,...
'RowName',rnames,'Position',[0 0 500 185]);
%Histogram
figure(1);
hist(sort_data,8);
title('Histogram')
xlabel('Interval');
ylabel('Frekuensi');
%PIE Diagram
figure(3);
pie(af)
title('Pie Diagram')
legend('Interval 16-21','Interval 22-27','Interval 28-33','Interval 34-
39','Interval 40-45', ...
'Interval 46-51', 'Interval 52-57', 'Interval 58-63')




1. Data Table


2. Histogram


3. Pie Diagram


15 20 25 30 35 40 45 50 55 60 65
0
5
10
15
20
25
Histogram
Interval
F
r
e
k
u
e
n
s
i
7%
18%
18%
16%
21%
6%
9%
5%
Pie Diagram


Interval 16-21
Interval 22-27
Interval 28-33
Interval 34-39
Interval 40-45
Interval 46-51
Interval 52-57
Interval 58-63