- Joined
- 7/6/11
- Messages
- 69
- Points
- 18
I literally gave you the exact way to do this. normrnd(0, 1, 10, numsim). 10*normrnd just multiplies each element of the vector by 10. You dont want to create 10 sample paths, you want to create numsum sample paths. Each sample path has 10 random variables.
you need to do cumprod before multiplying by s0. Also note that cumprod will return a matrix, not a vector...you need the last element of each column of the matrix. I would suggest coding this with a small numsum (say 5) and looking at the results each line gives (just leave off the semicolon). That will show you what is going on.
you need to do cumprod before multiplying by s0. Also note that cumprod will return a matrix, not a vector...you need the last element of each column of the matrix. I would suggest coding this with a small numsum (say 5) and looking at the results each line gives (just leave off the semicolon). That will show you what is going on.