ENGR 17 Practice Test 3 Name___________________ Make a folder PracticeTest3 and put all your scripts, function files AND PLOTS in it 1) If you roll a balanced PAIR of dice 300 times, how many times would you expect to obtain-A) a sum of 8? B) A sum of either 3,4 or 5? C) A sum of less than 9? HINT: The Matlab command to generate 300 throws of a six sided dice is ceil(rand(1,300)*6) Make a histogram of 300 throws of two dice. You may either count the hits manually on the histogram chart, or, for full credit, use the matlab vector/relational (and other) commands such as z(z<10) to obtain the answer directly from the command line. 2) Make a function file to compute the function foo(x) = x^2 / (sin(x) + 2) (note that foo(0) = 0, foo() = 2/2 and foo( /2) = 2/12) 3) Use quad to find the area under function foo for x ranging from 0 to 10, in other words, ∫ ( ) 4) Use a for loop and repeated calls to quad to generate AND PLOT a vector y formed by integrating foo from 0 to x, in other words, ( ) ∫ ( ) Start with an x vector of [0:0.1:10] and plot y vs x 5) Find AND PLOT the numeric solution to y' = t2 – y, given y(0) = 0 over 0<t<5
© Copyright 2026 Paperzz