Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N = 3;
- numericUpDown1.Value = N;
- UstawTablice();
- int blad;
- AZ = new Complex[N + 1, N + 1];
- BZ = new Complex[N + 1];
- XZ = new Complex[N + 1];
- Complex E1 = 100;
- Complex E2 = 240;
- double XL1 = 25;
- double XL2 = 10;
- double XL3 = 10;
- double XC1 = 10;
- double XC3 = 25;
- double R2 = 120;
- AZ[1, 1] = 1; AZ[1, 2] = -1; AZ[1, 3] = -1;
- AZ[2, 1] = new Complex(0, XL1-XC1); AZ[2, 2] = new Complex(R2, XL2); AZ[2, 3] = 0;
- AZ[3, 1] = 0; AZ[3, 2] = new Complex(-R2, -XL2); AZ[3, 3] = new Complex(0, XL3-XC3);
- BZ[1] = Complex.Zero;
- BZ[2] = E1;
- BZ[3] = 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]).ToString();
- textBox2.Text = "IIpK bilans: " + (E1 - XZ[1]*(Complex.j*(XL1-XC1)) - XZ[2]*(R2 + Complex.j*XL2)).ToString();
- double Pz = (E1 * XZ[1].Conjugate + E2 * XZ[3].Conjugate).Re;
- textBox3.Text = " Pz = " + Pz.ToString();
- double Podb = ((XZ[1] * XZ[1].Conjugate * Complex.j * (XL1 - XC1)) + (XZ[2] * XZ[2].Conjugate * (R2 + Complex.j * XL2)) + (XZ[3] * XZ[3].Conjugate * (Complex.j * (XL3 - XC3)))).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 * Complex.j*(XL1-XC1)) + (XZ[2]*XZ[2].Conjugate*(R2 + Complex.j*XL2)) + (XZ[3]*XZ[3].Conjugate*(Complex.j*(XL3-XC3)));
- textBox6.Text = "Sodb = " + Sodb.ToString();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement