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

The MATLAB ‘rand’ function generates random numbers from a uniform distribution

ID: 3803997 • Letter: T

Question

The MATLAB ‘rand’ function generates random numbers from a uniform distribution from 0.0 to 1.0. and the MATLAB function ‘randn’ generates random numbers from a normal Gaussian distribution with a mean of 0.0 and a standard deviation of 1.0.

The MATLAB "rand' function generates random numbers from a uniform distribution from 0.0 to 1.0. and the MATLAB function randn' generates random numbers from a normal Gaussian distribution with a mean of 0.0 and a standard deviation of 1.0. a) In a particular Matlab script, it is desired to implement the random variable "x" which is a random value taken from a Gaussian random distribution with mean 2.0 and variance 0.25. Complete the following Matlab statement assigning an appropriate value to x b) A Matlab script implements a 3 state Markov model. Assume that the parameters "al l, al2, a13, a21, a22, a23, 31, 32, a33" have all been defined in the script initialization and have already been set equal to the corresponding model transition probabilities. The parameter "state" has also been defined to represent the current state of the model (1, 2 or 3). The following segment of Matlab script is intended to determine the next state of the model given the current state and the predefined transition probabilities. Complete all of the indicated blank segments in the script in order to implement the correct state transition logic. if state 1 state-1; else if r State 2 else State 3; end else if state 2 if r state 1 else if r state 2 else state-3; end else if state 3 if r state l else if r state 2: else state-3 end end

Explanation / Answer

a) x = .5.*randn(1,1) + 2

Basically this is obtained by using concept of defining a random variable y = ax + b where a and b are constant. y has mean as a*(mean of x) + b and variance as = a^2(variance of x)

Now variance f randn is 1 and means is 0

and given mean is 2 and variance is .25

2 = 0 + b => b = 2

.25 = a^2(1) => a = .5

Good read: https://in.mathworks.com/help/matlab/math/random-numbers-with-specific-mean-and-variance.html

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote