Question: Please do this problem through the Matlab. The answer is better to be the script screenshot. Create a script named 'HW2 2.m'. Write 'clear;close all;elc'
Create a script named 'HW2 2.m'. Write 'clear;close all;elc' after your com- ments 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 ( each choices with 0.5 probability ). For 1 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 histogramn, try to type "lookfor histogram" in the command window. If that doesn't work, you can also try google searching (For example, "lookfor maximum' doesn't find the correct result, but "lookfor max' does.) 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. 2. Define a variable "v.min" which is the minimum value in v. 3. Define a variable "w.max" which is the maximum value in v. 4. Define a variable "w.mean" which is the mean value of the elements in v Tounded to the nearest integer 5. Define a variable "v-median" which is the median value of the elements in v. 6. Plot a histogram of the elements in v
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
