15 lines
264 B
Matlab
15 lines
264 B
Matlab
# We are solving ex 2
|
|
# We plot the pdf and cdf of the binomial
|
|
|
|
n = input("Give the number of trials n=");
|
|
p = input("Give the probability of success p=");
|
|
x=0:1:n;
|
|
|
|
px=binopdf(x,n,p);
|
|
plot(x,px,'*r');
|
|
hold on
|
|
|
|
xx=0:0.0001:n;
|
|
cx=binocdf(xx,n,p);
|
|
plot(xx,cx,'g');
|