Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- N = 4;
- numericUpDown1.Value = N;
- UstawTablice();
- int blad;
- double R1, R2, R3, R4, R5, L, C, XL, XC, E1, E2, ZE1, ZE2;
- Complex ComplexE2, ComplexE1;
- AZ = new Complex[N + 1, N + 1];
- BZ = new Complex[N + 1];
- XZ = new Complex[N + 1];
- E1 = 10;
- E2 = 10;
- R1 = 10;
- R2 = 10;
- R3 = 10;
- R4 = 10;
- R5 = 10;
- XL = 10;
- XC = 10;
- ZE1 = 5;
- ZE2 = 10;
- ComplexE1 = new Complex(E1, ZE1);
- ComplexE2 = new Complex(E2, ZE2);
- AZ[1, 1] = new Complex(1, 0);
- AZ[1, 2] = new Complex(-1, 0);
- AZ[1, 3] = new Complex(-1, 0);
- AZ[1, 4] = new Complex(1, 0);
- BZ[1] = new Complex(0, 0);
- AZ[2, 1] = new Complex(R1, -XC);
- AZ[2, 2] = new Complex(R2, 0);
- AZ[2, 3] = new Complex(0, 0);
- AZ[2, 4] = new Complex(0, 0);
- BZ[2] = new Complex(E1, ZE1);
- AZ[3, 1] = new Complex(0, 0);
- AZ[3, 2] = new Complex((-R2), 0);
- AZ[3, 3] = new Complex(R3, 0);
- AZ[3, 4] = new Complex(0, 0);
- BZ[3] = new Complex(E2, ZE2);
- AZ[4, 1] = new Complex(0, 0);
- AZ[4, 2] = new Complex(0, 0);
- AZ[4, 3] = new Complex(R3, 0);
- AZ[4, 4] = new Complex(R4+R5, XL);
- BZ[4] = new Complex(E2, ZE2);
- 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.0000000");
- textBox1.Text = "Ipk bilans =" + (XZ[1] - XZ[2] - XZ[3] + XZ[4]);
- textBox2.Text = "IIpk bilans =" + (ComplexE1 - XZ[1]*(R1 - Complex.j*XC) - XZ[2]*R2);
- textBox3.Text = "Moc odbiorników = " + ((XZ[1]*XZ[1].Conjugate)*(R1-Complex.j*XC) + (XZ[2] * XZ[2].Conjugate)*R2 + (XZ[3] * XZ[3].Conjugate)*R3 + (XZ[4] * XZ[4].Conjugate)*(R4+R5+Complex.j*XL));
- textBox4.Text = "Moc źródeł = " + ((ComplexE1 * XZ[1].Conjugate) + (ComplexE2 * XZ[3].Conjugate));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement