Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Put a simulation loop around your code to simulate several one - year periods. Use at least 1 0 0 0 simulations, and generate a

Put a simulation loop around your code to simulate several one - year periods. Use at least 1 0 0 0 simulations, and generate a histogram showing the distribution of the value of the stock at the end of a year. % Initialize the stock value S = zeros(1, 52); S(1) = 1; % Define the probability mass function p = [0.2, 0.4, 0.2, 0.2]; % Define the changes in stock value changes = [-0.2, 0, 0.2, 0.4]; % Simulate the stock value over one year for i = 2:52 % Generate a random number r = rand; % Determine the change in stock value if r < p(1) change = changes(1); elseif r < sum(p(1:2)) change = changes(2); elseif r < sum(p(1:3)) change = changes(3); else change = changes(4); end % Update the stock value S(i) = S(i-1) * (1 change); end % Plot the stock value over time plot(1:52, S); xlabel('Week'); ylabel('Stock Value'); title('Stock Value Over One Year')

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

Mathematics for Economics and Business

Authors: Ian Jacques

9th edition

129219166X, 9781292191706 , 978-1292191669

More Books

Students also viewed these Mathematics questions

Question

What is the high-low method?

Answered: 1 week ago