Selasa, 15 April 2014

Simulasi Distribusi Data Aturan Sturges


clc;clear all;
disp('Program   : Simulasi Distribusi Frekuensi Data Aturan Sturges');
disp('Programer : Syaharuddin');
D=input('Data = ');
n=length(D);
k=ceil(1+3.3*log10(n));
R=max(D)-min(D);
P=ceil(R/k);
a(1)=min(D);
b(1)=a(1)+P-1;
for i=2:k;
    a(i)=a(i-1)+P;
    b(i)=b(i-1)+P;
end
for i=1:k;
    F(i)=0;
    for j=1:n;
        if D(j)>=a(i)&D(j)<=b(i);
            F(i)=F(i)+1;
        end
    end
end
F=[a' b' F']

Reaksi:

0 komentar:

Poskan Komentar

Catatan Kuliah

Syaharuddin Al Musthafa