フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

Index exceeds matrix dimensions

1 回表示 (過去 30 日間)
Kevin van Berkel
Kevin van Berkel 2013 年 6 月 10 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
Hello all,
Anyone knows what goes wrong? I receive this error:
Index exceeds matrix dimensions.
on the following code:
X = [ones(M,1), r(:,t,1), r(:,t,2), r(:,t,3), r(:,t,4), r(:,t,5),...
z(:,t,1), z(:,t,1).^2, z(:,t,2), z(:,t,2).^2, z(:,t,3),...
z(:,t,3).^2, z(:,t,4), z(:,t,4).^2, z(:,t,5), z(:,t,5).^2, ...
z(:,t,1).*z(:,t,2), z(:,t,1).*z(:,t,3),z(:,t,1).*z(:,t,4),...
z(:,t,1).*z(:,t,5), z(:,t,2).*z(:,t,3), z(:,t,2).*z(:,t,4),...
z(:,t,2).*z(:,t,5), z(:,t,3).*z(:,t,4), z(:,t,3).*z(:,t,5),...
z(:,t,4).*z(:,t,5)];
referring to this function
function Weights = Portfolio_fmincon_multiple_it_state_vb_bs(r,z,gamma,r_f,constr_ON,... it_ON, N_max)
Help would be much appreciated!!
Thanks.
Kevin

回答 (2 件)

Azzi Abdelmalek
Azzi Abdelmalek 2013 年 6 月 10 日
You should look at the sizes of r and z, and check if their indices do not exceed those sizes
  3 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 6 月 10 日
You said that r is a 1000x20 double, then why to write
r(:,t,3)
Kevin van Berkel
Kevin van Berkel 2013 年 6 月 10 日
This should capture the multiple assets included.. But it's more a gues..

Kevin van Berkel
Kevin van Berkel 2013 年 6 月 10 日
This should capture the multiple assets included.. But it's more a gues..
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2013 年 6 月 10 日
Kevin, if you want to add a comment, just click on comment on this answer

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by