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 个评论
回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Loops and Conditional Statements 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!