Your task is to determine if the average length of a random walk varies
Ask Expert

Be Prepared For The Toughest Questions

Practice Problems

Your task is to determine if the average length of a random walk varies

%%% Your task is to determine if the average length of a random walk varies

%%% as you vary the number of dimensions.

%%% Example: N=1 -- random walk on the line; N=3 Random walk in 3D space.

%-----------------------------------

% Create a simulation for computing random walks in N dimensions where N

% is to be specified by the user.

% In particular, the user will specify the number of steps to be taken,

% the number of times the simulation is repeated.

% In addition, the summary statistics will be returned: mean and standard

% deviation of the distance from the origin traveled over the e.g. 1000

% repetitions of the simulation.

% A step is taken +/- one unit along a single dimension -- it is a random

% walk on a lattice rather than on arbitrary directions in real space.

nSteps = input('Enter the number of steps in a single run: ')

nRepeats = input('Enter the number of simulation runs to do: ')

nDimensions = input('Enter the number of dimensions of the space: ')

distanceStats = zeros(1,nRepeats); % Contains distance traveled in each run.

currentParticlePosition = zeros(1, nDimensions); % Start at (0,0, ..., 0)

%----------------------------------------------------------------------------

% Fill in all the code details here (easy to do with nested for loops):

%--------------------------------------------------------------------------

distTraveled = sqrt(sum(currentParticlePosition.^2)); % Euclidean distance from origin.

distanceStats(1,i) = distTraveled;

fprintf('Final Position: %6.2f \n', currentParticlePosition);

fprintf('The distance from the origin is: %6.2f \n', distTraveled);

meanDist = mean(distStats);

stdDist = std(distStats);

fprintf('Mean: %6.2f and standard dev: %6.2f of distance traveled. \n', meadDist, stdDist);

% -------------------------------------------------------------------------

% 1. Do enough simulation runs for nDimensions = 1, 2, 3, 10

% to draw conclusions about whether the distance from the origin varies

% with the number of dimensions.

%

% 2. Plot the mean and standard deviation of distStats for 1, 2, 3, 10

% to demonstrate your conclusion.

Hint
ComputerA simulation has an underlying purpose of shedding light on underlying mechanisms controlling how a system behaves. A simulation can be used to forecast how a system will behave in the future and determine what can be done so as to influence that behavior....

Know the process

Students succeed in their courses by connecting and communicating with
an expert until they receive help on their questions

1
img

Submit Question

Post project within your desired price and deadline.

2
img

Tutor Is Assigned

A quality expert with the ability to solve your project will be assigned.

3
img

Receive Help

Check order history for updates. An email as a notification will be sent.

img
Unable to find what you’re looking for?

Consult our trusted tutors.

Developed by Versioning Solutions.