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

MATLAB. I need a MATLAB code for 1,3,4,5,6 please. Problem 1. Let In = (3.xn-1 +

ID: 3353631 • Letter: M

Question

MATLAB. I need a MATLAB code for 1,3,4,5,6 please.

Problem 1. Let In = (3.xn-1 + 7) mod(100). Find x1, ... , 112 if x) = 0, 1, 2, and 4. |Hint: In Maple you may use a code: x := 0; for i from 1 to 12 do x := (3*I+ 7) mod 100; end do; press return to see what happens. Read about the loop command for in Maple help. Problem 2. With t1 = 23, x2 = 66, and In = 3.xn-1 + 5.xn-2 mod(100), n > 3 we will call the sequence un = In/100, n > 1, the text's random number sequence. Find its first 14 values. Problem 3. A family with three children is chosen at random and the number X of daughters is counted. Describe how to simulate an observation on X based on U unif[0, 1]. Problem 4. A girl who has two siblings is chosen at random and the number X of her sisters is counted. Describe how to simulate an observation on X based on U - unif[0, 1]. Problem 5. Let X be the time of the first success in a sequence of independent Bernoulli trials, each trail having probability p of success. Then X is a geometric random variable with parameter p and the probability mass function (pmf) pk = P(X = k) = (1 - p)k-ip, k = 1, 2, .... Show that, in order to simulate an observation on X, we can use X = in(U)/ln(1 - p)1, where U - unif[0, 1]. Here [x] denotes the rounding up a number x to the nearest integer (e.g., (1.3= 2). Problem 6. Simulate 20 observations on X corresponding to problems 3, 4, and 5. In Problem 5 take p = 1/2. Include printouts of your codes.

Explanation / Answer

1)

function y = modulus (x0)
x = zeros(13,1);
x(1) = x0 ;
for i = 2 : 13
    x (i) = mod ((3 * x(i-1) + 7) , 100) ;
end
for i = 1:12
y (i) = x(i+1);
end

// this function takes x0 as input and gives x1 to x12 as vector y

modulus (0)

ans =

     7    28    91    80    47    48    51    60    87    68    11    40

modulus(1)

ans =

    10    37    18    61    90    77    38    21    70    17    58    81

modulus(2)

ans =

    13    46    45    42    33     6    25    82    53    66     5    22

modulus(4)

ans =

    19    64    99     4    19    64    99     4    19    64    99     4

Please ask rest questions again

You can ask one question at a time by chegg policy

Please rate