Answered step by step
Verified Expert Solution
Question
1 Approved Answer
= Lt. However. Recall that the mean of a Discrete Uniform(k,1) random variable is EX] if we did not know this, one way to estimate
= Lt. However. Recall that the mean of a Discrete Uniform(k,1) random variable is EX] if we did not know this, one way to estimate the mean would be to just average the trials. Specifically, for realizations Xi, X2,... , Xm, the sample mean is Ax-Xi The code framework below generates numtrials realizations of a Discrete Uniform(k, e) random variable, calculates the sample mean up to the mth realization for m from 1 to numtrials, and plots the resulting sequence of sample means. Your job is to ill in the code needed to calculate the sample mean. Parameters numtrials 1000 ; IX = +5 ; 1Y +50; %Generate Discrete Uniform random variables %(MATLAB only generates Discrete Uniform random variables from 1:n for some %parameter n so we need to adjust it a bit.) X = random("Discrete Uniform ,,IX- lex + 1,numtrials, 1) + kX- 1; Y random("Discrete Uniform ,,LY-kY + 1,numtrials, 1) + kY- 1; %Calculate sample mean for an increasing number of trials samplemeanx zeros (1,numtrials) samplemeanY = zeros(1,numtrials); for m = 1 : nuntrials samplemeanX(m) samplemeanY(m) %%Your %%Your code for code for calculating 1/m calculating 1/m (X-1 (Y-1 X-m) Y-m) - * + + . * + + end %Plot plot (1:numtrials, samplemeanX) xlabel('Number of Trials') ylabel ('Sample Mean')
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started