[Main]     [Information]    [Email]    [Links]     [Goodies]    [Contact]

 

 

Random Process Mini Project

 

The task of this mini project is very important to the students that are in majoring of Electrical/Electronic Engineering for whom take the Random Processes course. This project can make the students more understand and can apply their knowledge through programming tools such as by using the MATLAB software. Beside that, this project also gives the student a deeper appreciation of random processes and also random signal and system.

The purpose of this assignment is to simulate and produce the Pascal Random Variable (RV) with the success probability p=0.2 and K th success, which is K= 4 by using a MATLAB. In this part of mini-project, we have to design a program to determine the distribution of Pascal RV on an experiment of tossing an unfair coin. This coin has the probability to get head at 0.2. The coin is flipped until get 4 success, which mean 4 heads.

 

%The program in how to simulate and obtain a distribution function of Pascal Random Variable.

 

trial = 150;          %Defining the number of trials

k = 4;               %kth  success is defined

n = 4;               %Initial value of n is defined

p = 0.2;             %Probability success is defined

flip = rand (trial)  

for i=1:1:trial       %The loop is set up from one and will be increased by one

                      %until it reaches the number of trials

   if flip(i)<=0.2       %execute the probability of success if the coin flip with the

                          %probability less or equal than 0.2

     prob(n)= NCHOOSEK(n-1,k-1)*(p^k)*((1-p)^(n-k));

                   %this the Pascal RV formula where to we used to measure the

                   %probability of k th success

    fig=bar(prob);     %display the probability result

    n=n+1;           %increment the value of n by one

     grid on;         %adds grid lines to the current axes      

     hold on;         %holds the current plot and all axis properties so that

                      %subsequent graphing commands add to the existing graph.

     title('PASCAL RANDOM VARIABLE');  %adds text at the top of the current axis as the topic.

     xlabel('n');          %adds text beside the X-axis on the current axis.

     ylabel('PN(n)');   %adds text beside the Y-axis on the current axis

  end                 %end for the 'if' loop

end                    %end for the 'for' loop

hold off;              %returns to the default mode whereby PLOT commands erase

                      %the previous plots and reset all axis properties before drawing

                      %new plots.

 

 

Other Assignments

%Finding estimated mean, standard deviation and variance.

addpath c:\random\

load Co2.dat

 

data='Co2.dat';

border=length(data)-4;

data=data(1:border);

z=eval(data);

samples=length(z);

meanx=mean(z);

stdevx=std(z);

varx=(stdevx)^2;

for Time=1:1:samples-9,

   M_i(Time)=mean(z(Time:Time+9));

   variance(Time)=(std(z(Time:Time+9)).^2)^2;

figure(1);

axis('off')

text (0.3,0.8,['Estimated Mean Data;',num2str(meanx)]);

text (0.3,0.6,['Estimated Standard Deviation;',num2str(stdevx)]);

text (0.3,0.4,['Estimated Variance;',num2str(varx)]);

end

 


 

 

Copyrighted® by WEBMASTER of UNITEX

1