Answered step by step
Verified Expert Solution
Question
1 Approved Answer
matlab home work pls help me Create a Matlab script in an m-file which does all of the following. Name this file HW2.m. All commands
matlab home work pls help me
Create a Matlab script in an m-file which does all of the following. Name this file HW2.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 "Y"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 "min" which is the minimum value in v. 3. Define a variable "max" which is the maximum value in v. 4. Define a variable mean" which is the mean value of the elements in v, rounded to the nearest integer. 5. Define a variable" 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started