关键词 > EMET3007/8012

EMET3007/8012 - Week 3 Lab

发布时间:2022-09-27

Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

EMET3007/8012 - Week 3 Lab

InstructionsYou are not expected to nish all exercises this week. Ex- ercises 1-4 are very simple problems to help you become used to the Matlab syntax. Exercises 5-9 are slightly more advanced, and are designed to assist with writing short programs.  If you are using a language other than Matlab, or have some familiarity with Matlab, feel free to start from Exercise 5. Otherwise I recommend you start from Exercise 1.

Exercise 1. Construct the matrices:

a =        .(、)     B =     2

in Matlab. Investigate the colon operator. What do you get if you type a(l:2) ? Why? What about a(l:2 :An ) ? Why?

Exercise 2. Solve the following linear system for x:

        5(7) 

Exercise 3. Using only the 言ifg function, construct the matrix

(0   5   3

You will want to use nAlp  ifg to learn more about the 言ifg function.

Exercise 4.  Compute the product of the elements on the main diagonal of matrix B (from exercise 1).  Compute the determinant of B using 言At(A) .  Do you get the same answers? Why?

Exercise 5.  Write a Matlab program which simulates ipping a loaded coin where the probability of getting a head is 0.7.   That is, a program which says Heads 70% of the time, and Tails 30% of the time.

Exercise 6. Simulate ipping the loaded coin 100 times and record the num- ber of heads.

Exercise 7.  Rey and Kylo are playing a coin-flipping game with a fair coin. When the coin comes up heads, Rey pays Kylo one dollar; if it comes up Tails, Kylo pays Rey one dollar.  Before play, Rey has $10 and Kylo has $5.  The game is over when one of them has no money left. Write a Matlab program to simulate this game.

Exercise 8. Consider the coin-flipping game from Exercise 7. Run this game 100 times, recording the winner each time. How often does Rey win?

Exercise 9. Consider the simulation in Exercise 8. Run this simulation 10000 times (each run of Exercise 8 requires 100 runs of Exercise 7), recording how often Rey wins each in each simulation.   Plot a histogram of Rey’s win proportions. What does this distribution look like?  Use nAlp  nistogrfm to learn about his- tograms.