Question: Please Solve this question by using Matlab. errors accumulate ran 1.1.6. It's reasonable to expect that floating point during a long computation, creating what is
errors accumulate ran 1.1.6. It's reasonable to expect that floating point during a long computation, creating what is known as a random walk. O average we expect as many errors to be negative as positive, so they tend to partially cancel out. Suppose we define a random sequence by x 0 and 4-1 1 for n 1, with the signs chosen by tossing a fair coin for each n. Let a, and B, be the average values of x, and I.,), respectively, over all such waks Then a classic result of probability is that a, 0 and (a) In MATLAB the function randn simulates drawing numbers from the normal or Gaussian distribution G.e., the bell curve) with mean zero and variance 1. Choose a unique positive integer seed value s (for example, use the last 5 digits of your phone number) and enter rng(s) to initialize the random number generator. Then the following code generates one random walk for n 10: r randn (10000,1); % draw random numbers % cumulative summation cunsum(sign(r)); We can plot every fifth number in the sequence using plot(x(1:5:end)), hold on Plot 50 such random walks all together on one graph. x (b) Perform a million random walks, computing the average values oft oe /2n/r at n-: 10000. and mooool. Compare these to " ~O and
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
