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 = 10, E2 = 10;
- double R = 10, L = 10;
- double C = 20;
- AZ[1, 1] = 1;
- AZ[1, 2] = -1;
- AZ[1, 3] = -1;
- AZ[2, 1] = 0;
- AZ[2, 2] = R;
- AZ[2, 3] = 0;
- AZ[3, 1] = 0;
- AZ[3, 2] = -R;
- AZ[3, 3] = new Complex(0, L - C);
- 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[2]*R).ToString();
- double Pz = (E1*XZ[1].Conjugate + E2*XZ[3].Conjugate).Re;
- textBox3.Text = " Pz = " + Pz.ToString();
- double Podb = (XZ[2] * XZ[2].Conjugate * R).Re + (XZ[3] * XZ[3].Conjugate * (Complex.j * L - Complex.j * C)).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[2] * XZ[2].Conjugate * R) + (XZ[3] * XZ[3].Conjugate * (Complex.j * L - Complex.j * C));
- textBox6.Text = "Sodb = " + Sodb.ToString();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement