I am going to convert three array as written in below into a Matrix (two dimensional array).
Actually I do effort a lot but couldn't understand how to fill the matrix here is my code:
double[] a1 = {2.1, 2.2, 2.3, 2.4, 2.5};
double[] a2 = {3.1, 3.2, 3.3, 3.4, 3.5};
double[] a3 = {4.1, 4.2, 4.3, 4.4, 4.5};
for(int i=0; i< a1.length; i++)
{
double[][] X = new double[i][3];
for(int j=0; j<3; j++)
{
X[i][j] = "How should I fill the X Matrix";
}
}
I expected that my result should be like this
// x1 x2 x3
X = { { 2.1, 3.1, 4.1 },
{ 2.2, 3.2, 4.2 },
{ 2.3, 3.3, 4.3 },
{ 2.4, 3.4, 4.4 },
{ 2.5, 3.5, 4.5 },
}