Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

? ?P lease include script code and output (Use MATLAB, do NOT do by hand) Using MATLAB R2017b: ?Please set up the program in the

??Please include script code and output (Use MATLAB, do NOT do by hand)

Using MATLAB R2017b:

?Please set up the program in the way the instructions ask for!

image text in transcribed

image text in transcribed

8. A random walk in two dimensions. Write a program, rw2d.m, to describe a walker making a random walk with unit steps in the x-y plane. The walker starts at the origin. Represent the walkers N positions using MATLAB arrays x and y. A good value to start with would be 1 x 103 The walk starts with x(1)-0. y(1) 0 (initialize both arrays to zero). Use a for loop to calculate the walker's moves. At each step the walker uses a random number to decide whether to take a step. e North (y increases by 1; x stays the same). . South (y decreases by 1; x stays the same). . East (r increases by 1; y stays the same) . West (x decreases by 1: y stays the same). The walker always takes a Notes: tep of length . a. Note that one can generate a random number in the set (1,2,3,4) by using the command idirection-randi (4); b. Animate the plot by plotting at each step istep. i. The starting position at the origin as an asterisk i. The path the walker has taken up to now by a curve. ii. The position of the walker at the present as an "o." E.g. plot(0, 0, ,r", axis equal x(1:k), yC1:k), x(k), y(k), 'ro); draw now

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored 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

Recommended Textbook for

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Sham Navathe

4th Edition

0321122267, 978-0321122261

More Books

Students also viewed these Databases questions

Question

600 lb 20 0.5 ft 30 30 5 ft

Answered: 1 week ago