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

MATLAB code/ 1- Write a vector of normally distributed random variable X, the me

ID: 3794586 • Letter: M

Question

MATLAB code/

1- Write a vector of normally distributed random variable X,

the mean mX = 15.

the standard deviation = 20% of the mean.

2- Using simulated vectors, find probability Pr(X > 30mX).

3- Compare the results with theory.

the code should display the theoretical and simulated probability , use remark % to comment on the results for any reasons in the simulation file

___________________________________________________________________________________________________________________

Note that:

- For the theory use qfunc( )

- Use vector sizes for stable result

Explanation / Answer

clear all;
clc;
close all;
X = randn(1,5)      %randomly distributed 5 num
mX = 15 ;            %mean = 15
Sd = 0.20 * mX ;     % standard deviation 20% of above mean

%standard normal distribution with mean mX and standard deviation Sd
                   % to check the condition
y = pdf('normal',X,mX,Sd)       %for random vector calculating probability distribution function

q = qfunc(X)            %to find q function

tf = isequal(y,q)        %returns 0 for false and 1 for true

plot(y, q)

xlabel('y')
ylabel('q')