Professional Documents
Culture Documents
% Using Exponential: For If Else If End End
% Using Exponential: For If Else If End End
% Using Exponential: For If Else If End End
k=[0 1 2 3 4];
l=length(k);
n=500;
m=(k(1)*p(1)+k(2)*p(2)+k(3)*p(3)+k(4)*p(4)+k(5)*p(5))/500;
lambda = 1/m;
e=exp(-lambda);
% Using Exponential
P2 = [];
lembda = 1/m;
P2(i) = Q;
end
E2 = [];
s = sum(p);
for i = 1:5
E2(i) = P2(i)*s;
end
figure(2)
b=[E2(1),p(1);E2(2),p(2);E2(3),p(3);E2(4),p(4);E2(5),p(5);];
disp(b)
bar(b)
disp(E1)
file:///C:/Users/Ibrah/html/Assignment1.html 1/3
12/25/2020 Assignment1
figure(1)
b=[E1(1),p(1);E1(2),p(2);E1(3),p(3);E1(4),p(4);E1(5),p(5);];
disp(b)
bar(b)
383.6175 271.0000
89.2927 142.0000
20.7842 66.0000
4.8378 15.0000
1.4677 6.0000
Warning: After pooling, some bins still have low expected counts.
The chi-square approximation may not be accurate
0
NaN
116.3825 271.0000
79.8384 142.0000
27.3846 66.0000
6.2619 15.0000
1.0739 6.0000
Warning: After pooling, some bins still have low expected counts.
The chi-square approximation may not be accurate
0
NaN
file:///C:/Users/Ibrah/html/Assignment1.html 2/3
12/25/2020 Assignment1
file:///C:/Users/Ibrah/html/Assignment1.html 3/3