Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N = 4;
- numericUpDown1.Value = N;
- UstawTablice();
- int blad;
- AZ = new Complex[N + 1, N + 1];
- BZ = new Complex[N + 1];
- XZ = new Complex[N + 1];
- double R1 = 10, R2 = R1, XL = R1, XC = R1;
- Complex E1 = 200, E2 = 100;
- AZ[1, 1] = 1; AZ[1, 2] = -1; AZ[1, 3] = -1; AZ[1, 4] = -1;
- AZ[2, 1] = R1; AZ[2, 2] = new Complex(0, XL); AZ[2, 3] = 0; AZ[2, 4] = 0;
- AZ[3, 1] = 0; AZ[3, 2] = new Complex(0, -XL); AZ[3, 3] = new Complex(0, -XC); AZ[3, 4] = 0;
- AZ[4, 1] = 0; AZ[4, 2] = 0; AZ[4, 3] = new Complex(0, XC); AZ[4, 4] = R2;
- BZ[1] = Complex.Zero;
- BZ[2] = E1;
- BZ[3] = -E2;
- BZ[4] = E2;
- for (int i = 1; i <= N; i++)
- {
- for (int j = 1; j <= N; j++)
- {
- MacierzA.Rows[i - 1].Cells[j - 1].Value = AZ[i, j].ToString();
- }
- WektorB.Rows[i - 1].Cells[0].Value = BZ[i].ToString();
- }
- if (radioButton1.Checked)
- {
- blad = MetodaGaussa.RozRowMacGaussa(AZ, BZ, XZ, 1e-30);
- }
- else
- {
- blad = MetodaRozkladuLU.RozRowMacCroutDoolitta(AZ, BZ, XZ, 1e-30);
- }
- if (blad == 0)
- for (int i = 1; i <= N; i++)
- WektorX[0, i - 1].Value = XZ[i].ToString("0.000000");
- textBox1.Text = "IpK bilans: " + (XZ[1] - XZ[2] - XZ[3] - XZ[4]).ToString();
- textBox2.Text = "IIpK bilans: " + (E1 - XZ[1]*R1 - XZ[2]*(Complex.j*XL)).ToString();
- double Pz = (E1 * XZ[1].Conjugate - E2 * XZ[3].Conjugate).Re;
- textBox3.Text = " Pz = " + Pz.ToString();
- double Podb = (XZ[1] * XZ[1].Conjugate * R1).Re + (XZ[2] * XZ[2].Conjugate * (Complex.j * XL)).Re + (XZ[3] * XZ[3].Conjugate * (-Complex.j * XC)).Re + (XZ[4] * XZ[4].Conjugate * R2).Re;
- textBox4.Text = "Podb = " + Podb.ToString();
- Complex Sz = new Complex(0, 0);
- Sz = E1 * XZ[1].Conjugate - E2 * XZ[3].Conjugate;
- textBox5.Text = " Sz= " + Sz.ToString();
- Complex Sodb = new Complex(0, 0);
- Sodb = (XZ[1] * XZ[1].Conjugate * R1) + (XZ[2]*XZ[2].Conjugate*(Complex.j*XL)) + (XZ[3]*XZ[3].Conjugate*(-Complex.j*XC))+(XZ[4]*XZ[4].Conjugate*R2);
- textBox6.Text = "Sodb = " + Sodb.ToString();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement