double[,] matrizZol = new double[9, 1];
double[,] X = new double[9, 2];
for (int i = 0; i < 9; i++)
matrizt[i, 0] = i + 1;
for (int i = 0; i < 9; i++)
matrizZ1[i,0]=Math.Pow(0.3017779,matrizt[i,0])*Math.Cos(3.1415927*matrizt[i,0]);
for (int i = 0; i < 9; i++)
matrizZ2[i,0]=Math.Pow(0.3017779,matrizt[i,0])*Math.Sin(3.1415927*matrizt[i,0]);
for (int i = 0; i < 9; i++)
{
X[i, 0] = matrizZ1[i, 0];
X[i, 1] = matrizZ2[i, 0];
}
B1 = operaciones.inversa(operaciones.multiplicacion(operaciones.transpuesta(X), X));
B2 = operaciones.multiplicacion(operaciones.transpuesta(X), operaciones.matrizY);
B = operaciones.multiplicacion(B1, B2);
matrizZ1 = operaciones.MatrizXNumero(matrizZ1, B[0, 0]);
matrizZ2 = operaciones.MatrizXNumero(matrizZ2, B[1, 0]);
matrizZol = operaciones.sumaMatrices(B1, B2);
}
private void Form1_Load(object sender, EventArgs e)
{
operaciones.filasM1 = 9;
operaciones.filasM2 = 9;
operaciones.columnasM1 = 1;
operaciones.columnasM2 = 1;
operaciones.Inicializar();
listPIB.Items.Clear();
for (int j = 0; j < operaciones.matrizY.GetLength(0); j++)
listPIB.Items.Add(operaciones.matrizY[j, 0]);
listCuadrados.Items.Add(operaciones.matrizX[0, 0] + " " + operaciones.matrizX[0, 1]);
for (int j = 1; j < operaciones.matrizX.GetLength(0); j++)
{
listCuadrados.Items.Add(operaciones.matrizX[j, 0] + " " + operaciones.matrizX[j, 1]);
}
}
private void button2_Click(object sender, EventArgs e)
{
double[,] B1 = new double[2, 2];
double[,] B2 = new double[2, 2];
double[,] B = new double[1, 2];
double[,] R = new double[9, 1];
double[,] R1 = new double[9, 2];
R = operaciones.MatrizLog(operaciones.divisionMatriz(operaciones.matrizK,operaciones.matrizL));
for (int j = 0; j < R.GetLength(0); j++)
{
R1[j, 0] = 1;
R1[j, 1] = R[j,0];
}
listKL.Items.Clear();
for (int j = 0; j < R1.GetLength(0); j++)
{
listKL.Items.Add(R1[j, 0] + " " + R1[j, 1]);
}
R = operaciones.MatrizLog(operaciones.divisionMatriz(operaciones.matrizY, operaciones.matrizL));
listYL.Items.Clear();
for (int j = 0; j < operaciones.matrizY.GetLength(0); j++)
listYL.Items.Add(R[j, 0]);
B1 = operaciones.inversa(operaciones.multiplicacion(operaciones.transpuesta(R1),R1));
B2 = operaciones.multiplicacion(operaciones.transpuesta(R1), R);
B = operaciones.multiplicacion(B1, B2);
listBEta3.Items.Clear();
listBEta3.Items.Add(B[0, 0]);
listBEta3.Items.Add(B[1, 0]);
txtA.Text = Math.Pow(Math.E, B[0, 0]).ToString();
}
}
}