ISAE/AESS-1
1
dx
x ba
x f x ( x ) dx =
{X}
=
1
x2
2(ba)
=
a
(b+a)(ba)
b a
=
2(ba)
2(ba)
----- (1.b)
b+a
2
V (X)
x 2 f x ( x)dx(
E { X 2 } ( E { X })2
b+a 2
) ----- Using the result from (1.b)
2
b
1
b+ a 2
1
b+ a 2
dx
=
x3
= x
ba
2
2
3 ( ba )
a
a
3
3
2
2
b a
b + 2ab +a
=
3 (ba)
4
2
2
2
2
(ba)(b + ab+a ) b + 2ab +a
3 (ba)
4
2
2
2
(b +ab +a ) b + 2ab +a2
b22 ab+ a2
=
=
12
3
4
2
( ba )
----- (1.c)
12
2
( ) [
] ( )
Question 2.
Plot the PDF. Verify that the sum of the PDF is unity. Verify that the theoretical mean
and variance are in accordance with the numerical values obtained with Matlab.
Answer 2:
Here, we set a = 0 and b = 1.
Theoretical mean:
b+a 1+0
=
2
2
= 0.5
(1.b)
( ba )2 ( 10 )2
(1.c)
=
=0.083 3
12
12
The numerical values of mean and variance are 0.5 and 0.083 3 respectively. (see Appendix 1 for
part 1 MATLAB code.) The following figure shows the PDF of a continuous uniform distribution on
the interval [0, 1]:
Theoretical variance:
Question 3.
Draw N samples from the distribution. Plot these N realizations. Using these samples, compute
the empirical i) mean; ii) variance; iii) PDF. Verify that the sum of the empirical PDF is unity. In the
same figure, plot the theoretical PDF with that obtained with the samples.
Answer 3:
Here we set N = 100. The figure with N-samples and the empirical PDF is as follows:
The empirical mean of the 100-sample distribution is 0.518046, and its variance is 0.080124. The
sum of the empirical PDF is 1.047120. This is greater than 1, but this is likely due to the low number
of bins in the histogram. Increasing this number would remove the discrepancy.
Part 2 - The Gaussian distribution
(Let X denote a real Gaussian random variable with mean and standard deviation .)
Question 1.
Recall the expression of its PDF and derive analytically its mean and variance.
Answer 1.
The expression of a Gaussian PDF:
2
1
f x ( x )=
e
2 2
( x )
2
2
{ X } x f x ( x )dx= x
[ ( x ) + ]
2 2
1
= ( x )
e
2 2
+
1
e
2 2
e
( x )
2
2
( x )
2
2
( x )
2
2
------ (2.a)
dx
dx
+
1
dx +
e
2 2
( x )
( x)
2
2
dx
2
( x )
( 2 ) x+2 e 2 dx + 1 2 e 2 dx
2
= 2
f x ( x ) dx
( x )
1 ( 2)
e 2 +
2
2
1
( 2 ) [ 00 ] + = ------ (2.b)
2
2
2
V ( X ) E {( XE { X }) }= ( x )2 f x (x ) dx
2
V ( X ) ( x )
2 2
( x )
2
2
dx
x
, then dx= 2 2 d
2
2
+
1
2 2
e 2 2 d
V (X) 2
2
2
+
2
2 +
2 2
2 2
2
e d= e d
2
2
we let =
V (X)
([
2 2
1
1
e d
2
2
lim
1
= lim
2 e
e
( )
2
= 0,
2 2
1
2
0
e d =
e d
V (X)
Question 2.
Plot the PDF. Verify that the sum of the PDF is unity. Verify that the theoretical mean
and variance are in accordance with the numerical values obtained with Matlab.
Answer 2:
Here, we set mean =0.0 and standard deviation = 1.0 . The numerical values of mean
and variance are 0.0 and 1.0 respectively. (see Appendix 2 for Part 2 MATLAB code). The PDF of
Gaussian distribution with =0.0 , = 1.0 is shown below:
Question 3.
Draw N samples from the distribution. Plot these N realizations. Using these samples, compute
the empirical i) mean; ii) variance; iii) PDF. Verify that the sum of the empirical PDF is unity. In the
same figure, plot the theoretical PDF with that obtained with the samples.
Answer 3:
Here, we set N = 500. The figure with N-samples and the empirical PDF is as follows:
The empirical mean of the 500-sample distribution is -0.074879, and its variance is 1.009664.
The sum of the PDF is 1.002004. (See Appendix 2 for MATLAB code.)
Part 3 - Experimental data
In this third part, we study experimental data. Samples were collected on a radar system while
pointing towards the sky during a sunny day. In that case only thermal noise is present in the data.
Note that the samples are complex-valued (IQ-receiver). The random variable X representing the
collected sampled can thus be decomposed into a real part and an imaginary part denoted as X R and
XI respectively.
Question 1.
Load the data stored in the MAT-file noise.mat. Once loaded, take a look at the available
variables in the MATLAB workspace with the command whos.
Answer 1:
See Appendix 3.1 for MATLAB whos() output.
Question 2.
Construct two vectors: one containing the real part of the samples, and one containing the
imaginary part of the samples.
Answer 2:
See Appendix 3.2 for Part 3 MATLAB code.
Question 3.
For each vector, plot the realizations and the empirical PDF.
Answer 3:
The noise signal is plotted separately, in real and imaginary parts, in the following figure:
Histograms of the data and fitted PDFs for each component are shown below:
Figure 3.2: Noise Amplitude Histogram and PDF for each Signal Component
Question 4.
Infer the type of distribution that could follow both random variables X R and XI. Using Matlab
functions, fit the empirical PDFs to the type of distribution inferred. What are the values of the
parameters of the fitted PDFs?
Answer 4:
Both real part and imaginary part vector are fitted based on Matlab General model Gauss2.
The general equation is:
xb1
c1
xb2
c2
( ) +a e ( )
f ( x )=a e
For the real signal component, the parameters of the fitted PDF are:
a1=0.5268,b 1=0.007966, c1 =1.065,a 2=0.01925, b2=0.287, c 2=0.1534
For the imaginary part vector, the parameters of the fitted PDF are:
a1=0.003051, b1=0.3737, c 1=0.01337, a2=0.5354,b2 =0.007875, c2 =1.049
Question 5.
Compute the correlation coefficient between XR and XI.
Answer 5:
The definition of correlation coefficient is:
= x, y
x y
where x , y is the covariance between random variables X and Y, and x means the standard
deviation of X. The correlation coefficient between XR and XI, as found by the part 3 MATLAB
code, is:
= -0.01577.
Question 6.
Plot the empirical joint PDF of XR and XI. From your observations propose a distribution that
could describe appropriately the vector [XR XI]T.
Answer 6:
Plot the empirical joint PDF of XR and XI.
The following figure is an empirical joint PDF of XR and XI:
Figure 3.3: Empirical Joint PDF of XR and XI, in Heatmap and 3D forms
Propose a distribution that could describe appropriately the vector [XR XI]T.
The covariance matrix of joint PDF is symmetric as well as semi-positive, and the plotting
result from figure 3.3 looks like typical Bivariate normal distribution model. Thus, we proposed
Bivariate normal distribution to fit the empirical joint PDF. The probability density function of
multivariate normal distribution in bivariate case is:
f XY ( x , y )=
1
2 X Y 1
exp
2
[( ) ( )
x X 2 xY 2
( x X )( yY )
1
+
2
2
X
Y
X Y
2( 1 )
]}
-----
(3.a)
The proposed distribution and the experimental distribution are very similar, indicating that our
assumption is correct that the empirical joint PDF could be described appropriately in Bivariate
normal distribution model.
APPENDIX
1. Part 1 MATLAB Code
%%
% File name: Uniform_Distribution.m
% Developer: Vikram Krishnaswamy AND Hao-Chih,LIN
% Date: 16/09/2016
%%
clear
clc
% Define parameters
a = 0;
b = 1;
range = b-a;
interval = 0.01;
% Plot PDF
x = a-range:interval:b+range;
y = unifpdf(x, a, b);
figure(1);
plot(x,y,'LineWidth',3);
hold on;
xlabel('x values');
ylabel('Probability Density');
title('The Uniform distribution');
% Show the sum of PDF is unity
distro_sum = integral(@(x)unifpdf(x,a,b), -inf, inf);
fprintf('The sum of PDF is: %f\n',distro_sum);
% Compute the theoretical mean value
meanfunction = @(x) x * unifpdf(x,a,b);
theorMean = integral(meanfunction,-inf,inf, 'ArrayValued',true);
fprintf('The theoretical mean is: %f\n',theorMean);
% Compute the theoretical variance value
varifunction = @(x) ((x - theorMean)^2) * unifpdf(x,a,b);
theorVariance = integral(varifunction, -inf, inf, 'ArrayValued', true);
fprintf('The theoretical variance is: %f\n',theorVariance);
% Compare the theoretical result with numerical result
[numerMean, numerVariance] = unifstat(0,1);
fprintf('The numerical mean is: %f\n',numerMean);
fprintf('The numerical variance is: %f\n',numerVariance);
% Draw N samples from distribution, plot N samples
N = 100;
n = unifrnd(a,b, N, 1);
pedef = unifpdf(n,a,b); % PDF of N samples
plot(n, pedef, 'r*');
% Compute the empirical mean and variance, PDF
randmean = mean(n);
randvari = var(n);
fprintf('The empirical mean of N-samples is: %f\n',randmean);
fprintf('The empirical variance of N-samples is: %f\n',randvari);
fprintf('For the PDF of N-samples, please check variable "pedef"\n');
% Plot the theoretical PDF with that obtained with the N-samples
histsamples = 20;
[hist_f, hist_x] = hist(n,histsamples);
histPDF = hist_f/trapz(hist_x,hist_f);
bar(hist_x, histPDF,'y');
fprintf('The sum of the empirical PDF is: %f\n', sum(histPDF) * ( hist_x(2)hist_x(1) ) );
%%
% File name: Gaussian_Distribution.m
% Developer: Vikram Krishnaswamy AND Hao-Chih,LIN
% Date: 16/09/2016
%%
clear
clc
% Define parameters
mu = 0;
sigma = 1;
xaxis_min = -20;
xaxis_max = 20;
interval = 0.001;
% Plot PDF
x = xaxis_min:interval:xaxis_max;
y = normpdf(x, mu, sigma);
figure(1);
plot(x,y,'LineWidth',4);
hold on;
xlabel('x values');
ylabel('Probability Density');
title('The Gaussian distribution');
% Show the sum of PDF is unity
distro_sum = integral(@(x)normpdf(x,mu,sigma), -inf, inf);
fprintf('The sum of PDF is: %f\n',distro_sum);
% Compute the theoretical mean value
meanfunction = @(x) x * normpdf(x,mu,sigma);
theorMean = integral(meanfunction,-inf,inf, 'ArrayValued',true);
fprintf('The theoretical mean is: %f\n',theorMean);
% Compute the theoretical variance value
varifunction = @(x) ((x - theorMean)^2) * normpdf(x,mu,sigma);
theorVariance = integral(varifunction, -inf, inf, 'ArrayValued', true);
fprintf('The theoretical variance is: %f\n',theorVariance);
% Compare the theoretical result with numerical result
[numerMean, numerVariance] =normstat(mu,sigma);
fprintf('The numerical mean is: %f\n',numerMean);
fprintf('The numerical variance is: %f\n',numerVariance);
% Draw N samples from distribution, plot N samples
N = 500;
n = normrnd(mu, sigma, N, 1);
pedef = normpdf(n, mu, sigma); % PDF of N samples
plot(n, pedef, 'r*');
% Compute the empirical mean and variance, PDF
randmean = mean(n);
randvari = var(n);
fprintf('The empirical mean of N-samples is: %f\n',randmean);
Bytes
80176
Class
struct
Attributes
%%
% File name: Experimental_Distribution.m
% Developer: Vikram Krishnaswamy AND Hao-Chih,LIN
% Date: 17/09/2016
%%
clearvars,clc,close all
%---------------------------------------------------------% Question.1: Data File Input
noise = load('noise.mat');
fprintf('The "whos" command result:\n');
whos('noise');
%---------------------------------------------------------% Question.3: Plot the realizations and the empirical PDF for each vector.
% Question.4: Fit the empirical PDFs to the type of distribution inferred.
figure;
hold on;
histsamples = 25;
bivarpdf_surf = subplot(4, 4, [2 6] );
[X,Y] = meshgrid(bar_axis_real,bar_axis_imag);
surf(X,Y,jointpdf); % surf 3D figure
bivarpdf_sc = subplot(4, 4, [10 14] );
imagesc(bar_axis_real,bar_axis_imag,jointpdf); % imagesc 2D figure
colorbar('south');
% Plot the Bivariate Gaussian Fit of Joint PDF
bivargauss = subplot(4, 4, [7 11] );
Bi_mean = [mean(realpart), mean(imagpart)];
Bi_cov = [var(realpart), gamma; gamma, var(imagpart)];
Bi_cov_eigen = eig(0.5*(Bi_cov+Bi_cov')); % Check if the covariance matrix is
semipositive or not.
x1 = -2.5:.2:2.5;
x2 = -2.5:.2:2.5;
[X1,X2] = meshgrid(x1,x2);
F = mvnpdf([X1(:) X2(:)],Bi_mean,Bi_cov);
F = reshape(F,length(x2),length(x1));
surf(X,Y,jointpdf,'FaceAlpha',0.8,'EdgeColor','none'); hold on;
surf(x1,x2,F,'FaceAlpha',0.6, 'FaceColor', 'green');
hold off;
legend('Histogram of PDF','Bivariate Gaussian Fit','Location','north');