Answer to Question #158203 in Statistics and Probability for dingweizhan

Question #158203

Create a Matlab script in an m-file which does all of the following. Name this file Hwk2.m. All commands should be followed by a semi-colon; so that when the script is run, nothing gets displayed to the screen. To receive full credit, you must use the exact variables names given below, and you must not have any terms getting printed to the screen. A random walk is represented by a vector beginning with 0 and where each subsequent entry in the vector is attained from the previous entry by adding a random choice of either 1 or -1. For example, a random walk might begin [0,-1,0,1,2,3,2,3,2,3,4,3,2,3,4,5]. For this homework, our random walks will always continue until we reach an entry of absolute value 10. We will investigate how many steps it takes before we reach an entry of absolute value 10. Some of the questions below require you to use a function in Matlab which we haven’t discussed yet. To find the names of these functions use the lookfor command. For example, to find the command for producing a histogram, try to type “lookfor histogram” in the command window. If that doesn’t work, you can also do some googling.

1. Make a vector “v” containing the lengths of 5,000 different random walks, each of which ends when it reaches an entry of absolute value 10. (This is the main part of this homework.)

2. Define a variable “vmin” which is the minimum value in v.

3. Define a variable “vmax” which is the maximum value in v.

4. Define a variable “vmean” which is the mean value of the elements in v, rounded to the nearest integer.

5. Define a variable ”vmedian” which is the median value of the elements in v.

6. Plot a histogram of the elements in v.


1
Expert's answer
2021-02-04T07:55:42-0500
Dear dingweizhan, your question requires a lot of work, which neither of our experts is ready to perform for free. We advise you to convert it to a fully qualified order and we will try to help you. Please click the link below to proceed: Submit order

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS