Trying to store data
Afficher commentaires plus anciens
Unable to perform assignment because the size of the left side
is 1-by-2298 and the size of the right side is 3-by-3.
Hey was just wondering if anyone could help me sort this. I am trying to calculate fores. I have a 3x3x766 matrix and am trying to generate a forecast using a loop but can't manage to make the left side the same as the right side.
% Length of window
initwin = 500;
% Total no of forecasts made
nfore = n - initwin;
% Store forecasts and target
fores = zeros(3,3,nfore);
target = zeros(nfore,3);
for i = 1:nfore;
rtmp = rets(i:i + initwin - 1,:);
% Extract full smoothed vol from estimation
portfolio_smoothed=ewma_multi(rets);
vol_smoothed = ewma_multi(rtmp);
finaldays=vol_smoothed(:,:,initwin);
Et=rtmp(initwin-1,:)'*rtmp(initwin-1,:);
% Generate forecast
fores(i,:)=smooth*finaldays+(1-smooth)*Et;
target(i,:)=rets(i+initwin,:);
end
Réponses (1)
Torsten
le 21 Oct 2022
fores(i,:)=
"fores" has three dimension, thus fores(i,i,:) ? I don't know where you want to save what and if the dimensions fit now.
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!