Simulate by MATLAB then solve it theory. 1- Using simulations, generate a vector
ID: 3794965 • Letter: S
Question
Simulate by MATLAB then solve it theory.
1- Using simulations, generate a vector of normally distributed RV X with a mean mX equals 73 and standard deviation of 20% of the mean.
2-Using simulated vectors, find the probability Pr(X > 2.5mX).
3- Compare with theory. Your code should display the theoretical probability and the simulated one. Inside your simulation file use remark % to comment on the results for any discrepancies.
Hints: - For theory use qfunc( )
- Use enough vector sizes for stable results.
Explanation / Answer
%%
clc;
close all;
clear all;
%%
mu=73;
sigma=73*0.2;
x = [0:.1:200];
norm = normpdf(x,mu,sigma);
plot(x,norm);
grid on;
xlabel('x');
ylabel('pdf');
title('Normally distributted data');
pr=0;
for i=1000+ 1000/2.5 :1:2000;
pr=pr+norm(i);
end
disp('The probability Pr(x>2.5*mX) is given by: ')
disp(pr)
disp('The Theoretical probability Pr(x>2.5*mX is given by: ')
qfunc(2.5*mu)