How to a create for loop for this ?
Ältere Kommentare anzeigen
data2 = data1(1:25,:);
Cc = cov(data2);
data3 = data1(26:51,:);
Cc1 = cov(data3);
data4 = data1(52:77,:);
Cc2 = cov(data4);
1 Kommentar
Shouldn't the indices be 26:50 and 51:75 to be consistent with the 25 rows of the 1st calculation? How many rows does your data1 matrix has?
While it's easy to write a loop, you can even do this without a loop in just one line, as long as the step is consistent and the height of the matrix is a multiple of the step.
Antworten (3)
Hannes Arnar
am 28 Jan. 2020
0 Stimmen
Hannes Arnar
am 28 Jan. 2020
0 Stimmen
Paresh yeole
am 28 Jan. 2020
Bearbeitet: Paresh yeole
am 28 Jan. 2020
0 Stimmen
There is inconsistency. The first covariance value is for 25 numbers and the other two are for 26 numbers. If you are looking for 25 no. sets then following loop would do.
for i =1:3
Cc(i) = cov(data(1+(i-1)*25 : 25*i,: ));
end
1 Kommentar
Hannes Arnar
am 28 Jan. 2020
Kategorien
Mehr zu Risk Management Toolbox finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!