Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
new_zap_do_3.2.docx
Скачиваний:
3
Добавлен:
01.03.2025
Размер:
975 Кб
Скачать
☆
      1. Модуль Sum_process

В данном модуле рассчитываются и храняться основные параметры сумм значений случайных величин.

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using ZedGraph;

namespace Kyrsovoi_erm

{

public class Sum_process

{

private Double[] sourse_process;

private int size;

private Double tay;

private PointPairList dest_process;

private Double c_count;

private Double[] gistX;

private Double xmin;

private Double xmax;

private PointPairList glist;

public PointPairList getGlist()

{

return glist;

}

public Sum_process(Double[]s_process,Double t)

{

tay = t;

size = s_process.Length;

sourse_process = new Double[size];

sourse_process = s_process;

}

public PointPairList Calculate_summ_count()

{

dest_process = new PointPairList();

Double sum;

int j;

int i_i;

for (int i = 0; i < size; i++)

{

i_i = i;

sum= sourse_process[i];

j = 0;

while ((sum<tay)&&(i_i+1<size))

{

j++;

sum += sourse_process[i_i++];

}

if (i == 0)

{

xmin = j;

xmax = j;

}

if (j < xmin)

{

xmin = j;

}

if (j > xmax)

{

xmax = j;

}

dest_process.Add(i,j);

}

return dest_process;

}

public PointPairList Calculate_gist(int c_c)

{

c_count = c_c;

Double[] gistY = new Double[c_c];

gistX = new Double[c_c];

Double korigor = (xmax - xmin) / c_c; //ширина коридора

//Считаем середину для каждого столбика гистограммы

int h = 0;

for (Double i = xmin + korigor / 2; i < xmax; i += korigor)

{

gistX[h] = i;

h++;

}

int j;

for (int i = 0; i < size; i++)

{

Double temp2 = dest_process.ElementAt(i).Y;

j = (int)(((dest_process.ElementAt(i).Y) - xmin) / korigor);

//j = (int)temp1;

if ((((dest_process.ElementAt(i).Y) - xmin) % korigor != 0) && ((dest_process.ElementAt(i).Y) != xmax))

{

gistY[j] = gistY[j] + 1;

}

else

{

if (((dest_process.ElementAt(i).Y) != xmax) && ((dest_process.ElementAt(i).Y) != xmin))

{

gistY[j - 1] = gistY[j - 1] + 1 / 2;

gistY[j] = gistY[j] + 1 / 2;

}

else

{

if ((dest_process.ElementAt(i).Y) == xmax)

gistY[j - 1] = gistY[j - 1] + 1;

if ((dest_process.ElementAt(i).Y) == xmin)

gistY[j] = gistY[j] + 1;

}

}

}

// Double temp = 0;

for (int i = 0; i < c_c; i++)

{

gistY[i] = gistY[i] / size;

// temp += gistY[i];

}

//temp = temp * korigor;

glist = new PointPairList(gistX, gistY);

return glist;

}

}

}

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]