- Thread starter
- #1

#### Chatman100

##### New member

- Jul 13, 2019

- 2

I need your help with this probability problem.

I have random variable x

_{1}which is normally distributed with mean m

_{1}and standard deviation sigma

_{1}.

The vector of random variables X

_{0}is of N elements, where each element is normally distributed with zero mean and standard deviation sigma

_{0}.

Now we do an experiment. In each experiment we cast x

_{1}and X

_{0}. Then we compare x

_{1}to the elements of X

_{0}. If x1 is greater than all the elements in X

_{0}the experiment is successful, otherwise it is a failure. This experiment is repeated K times.

I would like to calculate the probability of success.

Below is the code of the MATLAB simulation:

m0 = 0; %Mean of the elements in X0

sigma0 = 1; %Standard deviation of the elements in X0

m1 = 4.3; %Mean of the elements in x1

sigma1 = 1.2; %Standard deviation of the elements in x1

N = 1000; %Number of elements in X0

K = 800; %Number of experiments

X0 = randn(K, N)*sigma0 + m0;

x1 = randn(K, 1)*sigma1 + m1;

success_flag = zeros(K, 1); %Allocation

for k = 1:K

success_flag(k) = sum(x1(k) > X0( k, : )) == N;

end

success_percentage = 100 * sum(success_flag) / K;

disp(['Success percentage sim: ' num2str(success_percentage)]);

Looking forward to your help.