Filter löschen
Filter löschen

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

1 Ansicht (letzte 30 Tage)
Markus
Markus am 11 Feb. 2015
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.

Antworten (0)

Kategorien

Mehr zu Creating and Concatenating Matrices finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by