How to make vectors A1, A2,... A127. Rolling time window.

1 次查看(过去 30 天)
hey guys,
my problem is the following: i have a column vector (276x1)of S&P500 returns (276 monthly returns in total) and i need so to say 127 time windows (so 127 column vectors) with always a time frame of 150 months. So what i mean: The total time window is from Jan92 - Dec14, now i need a vector1 = Jan92 - Jun04; vector2 = Feb92 - Jul04, ...., vector127 = Jul02 - Dec14.
m = 150 returns=zeros(1,150)' for k=1:127 returns(k)=SP500(k:m+k-1,1) %SP500 is the column vector with all monthly returns end
That doesnt work. Can anyone help me?
Thx in advance.

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by