Question: MATLAB code sent: close all; clear all; clc N=100; P=0.1; nfine=[0:0.01:N]; Yb=binocdf(nfine,N,P); narray0=[0:N]; % x-axis for PMF Zb=binopdf(narray0,N,P); lambda=N*P; Yp=poisscdf(nfine,lambda); Zp=poisspdf(narray0,lambda); figure; stem(narray0,Zb,'b'); grid; hold

 MATLAB code sent: close all; clear all; clc N=100; P=0.1; nfine=[0:0.01:N];

MATLAB code sent:

close all; clear all; clc N=100; P=0.1; nfine=[0:0.01:N]; Yb=binocdf(nfine,N,P); narray0=[0:N]; % x-axis for PMF Zb=binopdf(narray0,N,P);

lambda=N*P; Yp=poisscdf(nfine,lambda); Zp=poisspdf(narray0,lambda);

figure; stem(narray0,Zb,'b'); grid; hold on stem(narray0,Zp,'*r'); hold off title('PMFs for binomial (blue) and Poisson (red) random variables, lambda=N*p')

figure; stem(narray0,log10(Zb),'b'); grid; hold on stem(narray0,log10(Zp),'*r'); hold off title('Log10 PMFs for binomial (blue) and Poisson (red) random variables, lambda=N*p')

figure; plot(nfine,Yb,'b',nfine,Yp,'r'); grid title('CDF of a Binomial (blue) vs Poisson (red) Random Variable');

A= -.1; B = 4.1;

a=int16(floor(A))+1 b=int16(floor(B)) ac=100*a bc=100*b

Pbinomial_cdf = Yb(bc+2) - Yb(ac+1) sum=0; for k=a+1:b+1 sum=sum+Zb(k); end Pbinomial_PMF=sum Ppoisson_cdf = Yp(bc+2) - Yp(ac+1) sum=0; for k=a+1:b+1 sum=sum+Zp(k); end Ppoisson_PMF=sum

return M=100000; Xb = random('bino',N,P,1,M); figure; plot(Xb); title(' Plot of the random values of a Binomial RV'); grid figure; hist(Xb,(N*10+1)); grid title(' Histogram obtained from simulated binomial random variable values') Xp = random('poiss',lambda,1,M); figure; plot(Xp); title(' Plot of the random values of a Poisson RV'); grid figure; hist(Xp,(N*10+1)); grid % Number of bins to capture the results depends on N. title(' Histogram obtained from simulated Poisson random variable values')

used in class to compares a binomial and a Poisson random Consider the script variable PMFs. It has been sent to you with this homework assignment. Add code to compute thep that X is in the range np Vp(i-p) which is the range: E[X] +-SD(X) for the Binomial RV. Do it two ways A- Use -np to match the Poisson with the Binomial (match the means, as given in the original script) B. Choose ? close to np but possibly finding a better match of the PMFs (experiment by looking at the plots, how they compare graphically, or match the variances instead) and see if the difference in the computed probability is less than in part A used in class to compares a binomial and a Poisson random Consider the script variable PMFs. It has been sent to you with this homework assignment. Add code to compute thep that X is in the range np Vp(i-p) which is the range: E[X] +-SD(X) for the Binomial RV. Do it two ways A- Use -np to match the Poisson with the Binomial (match the means, as given in the original script) B. Choose ? close to np but possibly finding a better match of the PMFs (experiment by looking at the plots, how they compare graphically, or match the variances instead) and see if the difference in the computed probability is less than in part A

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!