# How do I simulate stock prices for a 10 asset portfolio, over a period of 10 years in MATLAB? [closed]

If I have given vectors for return and volatility (i.e. I have two 1x10 vectors), and I assume at first that their correlation is 0 (meaning my covariance-variance matrix is just diagonal), how do I simulate daily stock prices for the 10 year period?

-

## closed as off-topic by Joshua Ulrich, Clebson Derivan, olaker♦Feb 19 '14 at 20:06

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "Basic financial questions are off-topic as they are assumed to be common knowledge for those studying or working in the field of quantitative finance." – Joshua Ulrich, Clebson Derivan, olaker
If this question can be reworded to fit the rules in the help center, please edit the question.

Use normrnd to simulate daily log returns, then convert to prices. Mvnrnd does the same simulation, but since you're dealing with a diagonal covariance matrix it just transforms it by the cholesky, which is the identity matrix. Note that this only means you simulate from a distribution with 0 correlations. It does not mean that the simulated correlation matrix will be an identity matrix. See this: mathworks.com/matlabcentral/fileexchange/… – John Feb 19 '14 at 21:53
there is the full commented code on this wii: en.literateprograms.org/Monte_Carlo_simulation_(Matlab) – lehalle Feb 19 '14 at 22:17

A very simple approach could be the following: draw a random number for each day for each stock. If you refer to "average/mean" by return and to "standard deviation/variance" by volatility, you could use these for the distribution parameters of the random numbers per stock. If you dislike that values can go below zero, apply Euler's exponential function on each random number. This link and its references explain a similar approach.

-