Probability Density Function Estimation

advertisement

Probability Density Function Estimation

by Laurence G. Hassebrook

1-18-2013

Generate 3 noise sequences of length N as uniform, Gaussian and Rayleigh distributed. (let

N=10000) Then bin them in Nbin=100 bins and normalize to represent pdf estimates.

%% pdf estimation clear all ;

N=10000;

Nbin=100;

PART A: UNIFORM DISTRIBUTION

Step 1: Generate a uniform noise sequence using MATLAB rand(1,N) function.

%% uniformly distributed noise urv=rand(1,N); figure(1); plot(urv); title( 'Uniform Noise' ); xlabel( 'n' ); ylabel( 'x' ); print -djpeg Fig1_UniformNoise

Figure 1: (left) Uniform noise sequence. (right) Rotated distribution of values.

Step 2: Generate a Gaussian noise sequence using MATLAB randn(1,N) function. grv=randn(1,N);

1

Figure 2: (left) Gaussian noise sequence. (right) Rotated distribution of values.

Step 3: To generate a Rayleigh distribution, you can first generate two independent Gaussian sequences. xrv=randn(1,N); yrv=randn(1,N);

The function that yields a Rayleigh is the square root of the sum of the squares such that: rrv=sqrt(xrv.^2+yrv.^2);

Figure 3: (left) Rayleigh noise sequence. (right) Rotated distribution of values.

Step 4: Generate normalized pdf estimates for the uniform, Gaussian and Rayleigh noise sequences. The uniform pdf estimate is generated as:

%% BIN THE NOISE SEQUENCES n=1:Nbin;

% Uniform PDF fu=hist(urv,Nbin); maxu=max(urv);minu=min(urv); % minu=au * 1 + bu, maxu=au * Nbin + bu,

% au=(maxu-minu)/(Nbin-1); bu=minu-au; au=(maxu-minu)/(Nbin-1);bu=minu-au; nu=au * n + bu;

% normalize pdf to 1

2

du=(maxu-minu)/Nbin; fu=fu/(du*sum(fu));

The other two pdfs are estimated in the same procedure. All plotted together are shown in Fig. 4.

Figure 4: PDF estimates from the three noise sequences.

3

Download