Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Now we would like to get an idea of where the average drunken sailor will be after Nsteps. Thus, write a MATLAB m file

2. Now we would like to get an idea of where the average drunken sailor will be after Nsteps. Thus, write a MATLAB m file that will have as inputs both the number of steps your sailors will take (Nsteps) and the number of sailors you would like to track (Nsailors). The output of this mfile should be two vectors. The first vector (x) should be a list of the possible final positions of the sailor (you will need to generate this as a function of Nsteps). The second vector (loc) should contain the number of your Nsailors that finished at each of those locations. Finally, use MATLABs scatter command (use the help to see the proper syntax) to plot loc vs. x.

What is the name of your MATLAB mfile for this problem? __________________

Have your MATLAB script generate plots for a few values of Nsailors and Nsteps. Use a number of sailors big enough to get good data (at least >1000) but not so many that the calculation takes too long (<500000). Consider values for Nsteps ranging from 5 to 15. It should be apparent that loc takes on a functional form similar to a nonnormalized Gaussian distribution.

For Nsailors=10000 and Nsteps=10, what are your results for the vectors

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions