3.2. Solved exercises


The aim of this exercise is to become more familiar with the Gaussian distribution, currently used in signal processing. Generate 1,000 zero-mean normally distributed random samples with the variance 1 using the function randn. Plot on the same figure the histogram and the theoretical pdf. Repeat the same experiment for a non-zero mean. Then consider a different value for the signal variance. Finally, decrease the number of samples from 1,000 to 20. Comment on the obtained results.

The Gaussian distribution occurs very frequently in the real world. For example, a mechanical factory may specify a Gaussian distribution of its manufactured wheel diameter around the nominal value of 1 m, with a standard deviation of 0.04 m. Let us consider that customers only accept wheels whose diameter is between 0.95 and 1.05 m. Give an approximation of the merchandise percentage which will not be sold by the manufacturer.

mu=0; sigma=1; %Mean and standard deviation
ech = randn(1,Ntotal) .* sigma + mu;
Nclas=8; dx=.01;
y=exp(-0.5*((x-mu)/sigma).^2)/(sqrt(2*pi)* sigma);
figure;clf;zoom on;
subplot(221); hold on;
bar(X,N/Ntotal); plot(x,y,'r');
title('N(0,1), 1000 samples ');
hold on;plot(x,y,'r',)

%% Change the mean
y=exp(-0.5*((x-mu)/sigma).^2)/(sqrt(2*pi)* sigma); subplot(212); hold on;plot(x,y,'b--') %% Change the variance (or the standard ...

Get Digital Signal Processing Using Matlab now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.