Н.А. Малахов, И.Р. Танташев
6
Программа рекуррентного МП-моделирования, реализованная на
языке C#:
double u = -eps / T;
double v = Math.Sqrt(1 — eps * eps) / T;
Matrix Af = new Matrix(2, 2);
Af[0, 0] = (Math.Cos(v * d) * v — u * Math.Sin(v * d)) *
Math.Exp(u * d) / v;
Af[0, 1] = Math.Sin(v * d) * Math.Exp(u * d) / v;
Af[1, 0] = -Math.Sin(v * d) * (u * u + v * v) *
Math.Exp(u * d) / v;
Af[1, 1] = (u * Math.Sin(v * d) + v * Maееth.Cos(v * d))
* Math.Exp(u * d) / v;
Matrix Bf = new Matrix(2, 1);
Bf[0, 0] = -Math.Exp(u * d) * K * Math.Cos(v * d) + K +
Math.Exp(u * d) * K * u * Math.Sin(v * d) / v;
Bf[1, 0] = Math.Exp(u * d) * Math.Sin(v * d) * K * u * u
/ v + Math.Exp(u * d) * K * Math.Sin(v * d) * v;
Matrix Cf = new Matrix(1, 2);
Cf[0, 0] = 1;
Cf[0, 1] = 0;
Matrix X = new Matrix(2, 1);
X[0, 0] = 0;
X[1, 0] = 0;
List<Matrix> Y_list = new List<Matrix>();
for (int i = 0; i < N; i++)
{
Y_list.Add(Cf * X);
X = Af * X + Bf;
}