Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Module 7 Code: Exercise 1 Write a Matlab function that uses your Matlab random walk function from Module 7 to generate a collection of trajectories

image text in transcribed

Module 7 Code:

image text in transcribed

Exercise 1 Write a Matlab function that uses your Matlab random walk function from Module 7 to generate a collection of trajectories with fixed parameters, where the inputs are the number of time steps N, the probability of right step pR, and the number of runs NRuns; and the output is the final position zf of the walker after the N steps. You will be required to submit a M-file Exercise 2 Investigate the output by plotting a histogram of the final positions (use hist() in Matlab). Describe how the shape histogram can be increased from the default value when NRuns is large.) Enter description function walk randomWalk( pR,N walk zeros (1,N+1) ; Efor i-2:N+1 x-rand O; walk(i)-walk(i-1) +1: else walk(i)-walk(i-1)-1: end end end

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