Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Normal (Gaussian) Distribution Question 1) We say x is a normal or Gaussian rand

ID: 3678846 • Letter: N

Question

Normal (Gaussian) Distribution

Question 1)

We say x is a normal or Gaussian random variable with parameter and if its density function is given by:

and its distribution function is given by:

We can express in term of the error function (erf) as follows:

The probability density function (pdf) and cumulative distribution function (cdf) of normal distribution can be calculated using two built-in functions normpdf and normcdf in matlab.

a) Write two Matlab function on your own based on above equations, one for calculating normal pdf and one for calculating normal cdf. (treating as inputs of the functions)

b) With x=[-6, 6], plot the pdf and cdf for the following pairs of : (0, 1), (0,, (0, , (-3, 1), (-3, ), (-3, . (Please plot them in two figures: one contains all the pdf curves, and one contains all the cdf curves)

c) What can you observe about the affect of on normal pdf and cdf curves?

Question 2)

Consider books with thicknesses, W, uniformly distributed between 1 and 3 cm. These books are piled in stacks of N=1, 2, 3, 4, 5, 10 or 15 books. Plot the simulated height distribution (use hist function with number of bins equal 10) for each stack of N books; and compare with a Gaussian distribution with a mean of and a standard deviation of .

You just need to show plots for N= 1, 2 and 10.

Notice: The solution for each answer should be the Matlab code, followed by the figures. Answer which has no Matlab code will not get any credit.

I need a help to make this questions to write MATLAB codes.

Please help me

Explanation / Answer

a)

function plotGauss()
mu = [1 0]’;
S = [0 1; 1 0];
% covariance
clf
plotSurf(mu, S, 1)

[U,D] = eig(S); % U = eigenvectors, D= diagonal matrix of eigenvalues.
A = sqrt(inv(D))* U’;
mu2 = A * mu;
S2 = A * S * A’;
plotSurf(mu2, S2, 3)
plotSurf(mu, S, figndx)
[U,D] = eig(S);

B)

stepSize = 0.5;
[x,y] = meshgrid(-6:stepSize:6,-6:stepSize:6);
% Create grid.
[r,c]=size(x);
% data(k,:) = [x(k) y(k)] for pixel k
data = [x(:) y(:)];
p = mvnpdf(data, mu’, S);
p = reshape(p, r, c);
% scale density so it sums to 1
p=p * stepSizeˆ2; % p2(x,y) defeq p(x: x+dx, y: y+ dy) approx p(x,y) dx dy
assert(approxeq(sum(p(:)), 1, 1e-1))

subplot(-3,3,figndx)
surfc(x,y,p);

% Plot contours
axis(’square’);
xlabel(’x’,’fontsize’,15);
ylabel(’y’,’fontsize’,15);

line([mu(1) mu(1)+sqrt(D(1,1)) * U(1,1)],[mu(2) mu(2)+sqrt(D(1,1)) * U(2,1)],’linewidth’,3)

line([mu(1) mu(1)+sqrt(D(2,2)) * U(1,2)],[mu(2) mu(2)+sqrt(D(2,2)) * U(2,2)],’linewidth’,3)

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote