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

MATLAB QUESTION 3: Write a MATLAB® program that: 1. generates a vector containin

ID: 3592549 • Letter: M

Question

MATLAB QUESTION 3:

Write a MATLAB® program that: 1. generates a vector containing one million Gaussian random numbers with zero mean and unit standard deviation (i.e., just use 'randn') standard deviation is equal to 1 sigma) 3. counts the number of elements that are not within 5 sigma (note: length(a) returns the number of elements in vector 'a) 4. outputs the percentage of elements, out of the total, that are not within 5 sigma NOTE: The MATLAB® help info for randn (recall that the standard normal distribution has a mean of zero and a standard deviation of unity) randn Normally distributed pseudorandom numbers R = randn(N) returns an N-by-N matrix containing pseudorandom values drawn from the standard normal distribution. randn(M,N) or randn([M,N rturns an M-by-N matrix. randn(M,N,P.. or randn([M,N,P..]) returns an M-by-N-by-P-by.. array. randn returns a scalar. randn(SIZE(A)) returns an array the same size as A.

Explanation / Answer

tol=1e-15; [m,n] = size(A); if m ~=n error('The matrix is not square.') end % % Perform Gaussian elimination % for k=1:n-1 % find max pivot p and its index r relative to diagonal in column k [p,r] = max(abs(A(k:n,k))); % check pivot size if abs(p)