MATLAB The Random Walker

User Generated

RFFNZ111

Programming

Description

Create the Random Walker toy that tracks the movement of n balls as they move through the toy. As the balls fall down the toy, they can move to either the right or left of each peg. There are total of 15 levels with 16 columns to capture each of the balls.

Using a combination of functions, loops, and vectors to create the Random Walker toy. Create a figure that includes all of the pegs, and shows each ball individually dropping through the pegs (Hint use the drawnow command). At the bottom, show the balls colleting in columns. Increase the number of balls. How does this change the distribution?

below you will find the file that has the explanation of this assignment, also there is an example of this assignment in the pics below.

Unformatted Attachment Preview

The Random Walker     Due April 9th by Midnight Work in Groups of up to 3 students Submit exercise via email. Note: All programming must be done by the individual groups (NO COPYING). This is a graded homework activity. Do not use predeveloped code from the internet. Exercise: Create the Random Walker toy that tracks the movement of n balls as they move through the toy. As the balls fall down the toy, they can move to either the right or left of each peg. There are total of 15 levels with 16 columns to capture each of the balls. Using a combination of functions, loops, and vectors to create the Random Walker toy. Create a figure that includes all of the pegs, and shows each ball individually dropping through the pegs (Hint use the drawnow command). At the bottom, show the balls colleting in columns. Increase the number of balls. How does this change the distribution? Resources: https://www.youtube.com/watch?v=5jQwZ2VgRZQ https://en.wikipedia.org/wiki/Normal_distribution https://en.wikipedia.org/wiki/Random_walk WhatsApp ..... LTE 9:29 PM 1 53% Close April 9th M - 785 Bytes clc clear all close all n = 100; x = zeros(n,1)+1; y = x; for i = 2:1:n if i = 34 x(i) = -1 + x(i-1); else x(i) = 1 + x(i-1); end y(i) = -1 + y(i-1); scatter(x(1:i),y(1:i)) drawnow $plots as it goes through the system end %% Playground x= [5 4 3 2 1 6 7 8 9 5 4 6 3 5 71; y= (5 4 3 2 1 4 3 2 1 3 2 2 1 1 1]; scatter(x, y, 'r', '.') Email Save WhatsApp •.•.• LTE 9:29 PM 1 53% Close RandomWalk M - 523 Bytes clc clear all close all n = 1000; x = zeros(n,1); y = x; for i = 2:1:n x(i) = 2*rand-1 + x(i-1); y(i) = 2*rand-1 + y(i-1); plot(x(1:i),y(1:i)) drawnow %plots as it goes through the system end Email Save
User generated content is uploaded by users for the purposes of learning and should be used following Studypool's honor code & terms of service.

This question has not been answered.

Create a free account to get help with this and any other question!

Similar Content

Related Tags