4 ms·
In Matlab, where one is generally compelled (for better or worse) to think in terms of array operations, the obvious code would be: plot(mean((cumprod(randn(10
by psb217 15y ago
In Matlab, where one is generally compelled (for better or worse) to think in terms of array operations, the obvious code would be:
plot(mean((cumprod(randn(100,1000) .* 0.03) .* 15))
Well, that is assuming one wants a line plot of the mean value of the "location" at each time point across the population of walks. Personally, I find R's rather idiosyncratic approaches to data handling and function wrangling a bit hard to digest.