Array indices must be positive integers or logical values.

2 ビュー (過去 30 日間)
Lorenzo Reda
Lorenzo Reda 2021 年 3 月 14 日
回答済み: Star Strider 2021 年 3 月 14 日
Pls tell me where is the error.
for i= 0.01:0.02:0.99
w1_temp= i;
w2_temp= 1-i;
Rp_temp= w1_temp*mean(R_2(:,1))+w2_temp*mean(R_2(:,2));
Sp_temp= sqrt((w1_temp^2)*var(R_2(:,1))+(w2_temp^2)*var(R_2(:,2))...
hold on
xlim([0 2]);
ylim([0 0.12]);

回答 (2 件)

madhan ravi
madhan ravi 2021 年 3 月 14 日
ii = 0.01:0.02:0.99;
w1_temp= ii;
w2_temp= 1-ii;
Rp_temp= w1_temp*mean(R_2(:,1))+w2_temp*mean(R_2(:,2));
Sp_temp= sqrt((w1_temp.^2)*var(R_2(:,1))+(w2_temp.^2)*var(R_2(:,2))...
xlim([0 2])
ylim([0 0.12])

Star Strider
Star Strider 2021 年 3 月 14 日
Not able to run the posted code:
Unrecognized function or variable 'R_2'.
That aside, be absolutely certain that you have not created variables named ‘mean’, ‘sqrt’, ‘var’, ‘plot’. ‘xlim’,’ylim’ or ‘C’, since creating those variables would throw the (unposted object) error.
Cannot go further without more information.


Help Center および File ExchangeShifting and Sorting Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by