Info
This question is closed. Reopen it to edit or answer.
Multiple plots and Projections
1 view (last 30 days)
Show older comments
For my assignment I've got to create 5 projections of a stock price.
I've got this so far for random share prices with a specific start price and specific volatility.
if true
% code
end
function [Y] = geometric_brownian(NSteps,mu,sigma,T)
NSteps = input(’number of step:’);
T = input(’Enter length of interval:’);
mu = input(’Enter drift:’);
sigma = input(’Enter volatility:’);
t = (0:1:NSteps)’/NSteps;
W = [0; cumsum(randn(NSteps,1))]/sqrt(NSteps);
t = t*T;
W = W*sqrt(T);
X = (mu-(sigma^2)/2)*t + sigma * W;
Y = exp(X);
plot(t,Y);
title([’Sample Path of Geometric Brownian motion
with diffusion cofficient=’ num2str(sigma),’ Interest rate=’ num2str(r) ])
xlabel([’Time’])
- Item one How can I get 5 projections to be plotted on the same graph?
- Item two Is there a way I can use existing historical share prices (which I've imported to excel) and use those to make realistic projections?
I don't mind altering the code if needed to.
0 Comments
Answers (0)
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!