Can you solve problem 3 by using MATLAB only Use Excel if ne
Can you solve problem #3 by using MATLAB only? Use Excel if necessary to display data.
In order to access the question use the following link;
https://bilginerticaret.egnyte.com/dl/uX33R6N25t
Solution
MatLab Code:
%Consider k=4 , n=6 and p=.5
 k=4;
 n=6;
 p=.5;
 P(1)=(1-p)^2;
 fprintf(\'\  P(0)=%.4f\ \',P(1));
 for k=1:(n-1)
 P(k+1)=(((n-k)*p)/((k+1)*(1-p)))*P(k);
 fprintf(\'\  P(%d)=%.4f\ \',k,P(k+1));
 end
Output:
P(0)=0.2500
P(1)=0.6250
P(2)=0.8333
P(3)=0.6250
P(4)=0.2500
P(5)=0.0417
 >>

