我寫了一段代碼來操作時間序列數據的內容並輸出到新創建的矩陣中。這是爲了讓我爲時間序列數據構建相位空間。操縱列表
該列表是長度= N的一維稱爲「噪聲」。
我想創建一個MxN矩陣,其中m = N -5*tdelay1
和n = 6
。當代碼符合它會顯示錯誤:
Index was outside the bounds of the array.
的代碼如下:
float[,] phaseSpace6 = new float[(length-5*tdelay1-1), m];
for (int i = 0; i < (length-5* tdelay1-1); i++)
{
int col1 = i + tdelay1;
int col2 = i + 2 * tdelay1;
int col3 = i + 3 * tdelay1;
int col4 = i + 4 * tdelay1;
int col5 = i + 5 * tdelay1;
phaseSpace6[i, 1] = noise[i];
phaseSpace6[i, 2] = noise[col1];
phaseSpace6[i, 3] = noise[col2];
phaseSpace6[i, 4] = noise[col3];
phaseSpace6[i, 5] = noise[col4];
phaseSpace6[i, 6] = noise[col5];
}
我不知道爲什麼發生這種情況,有人新的節目。如果有經驗的人能幫助我,我將不勝感激。
爲什麼不使用'phaseSpace6.GetLength(0)'和'phaseSpace6.GetLength(1)'?由於缺乏努力,我必須低估這個問題。 – 2012-07-11 16:16:25