累积高斯分布和正态分布
Cumulative gaussian distribuation and normal distribuation
我做了这个代码
#region const
private double e = 2.7182;
private double pi = 3.1415;
#endregion
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double sr = double.Parse(srednia.Text);
double od = double.Parse(odchylenie.Text);
Random randVar = new Random();
chart1.Series.Add("Gauss");
chart1.Series["Gauss"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column;
NextGaussian(sr, od);
}
private void NextGaussian(double mean, double stdDev)
{
for (double i = 3 - 2 * 3; i <= 3; i = i + 0.1)
{
var r_normalny = (1 / (stdDev * Math.Sqrt(2 * pi)) * Math.Pow(e, ((-(i - mean) * (i - mean)) / 2 * (stdDev * stdDev))));
chart1.Series["Gauss"].Points.AddXY(i, r_normalny);
}
}
}
}
但我不知道它是否有效..而且我对累积分布有疑问。我找到了计算这个的公式,但没有任何效果..
我做过这样的东西。我添加了所有变量以进行更改。泊松分布的正态、累积。完美运行。
我做了这个代码
#region const
private double e = 2.7182;
private double pi = 3.1415;
#endregion
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
double sr = double.Parse(srednia.Text);
double od = double.Parse(odchylenie.Text);
Random randVar = new Random();
chart1.Series.Add("Gauss");
chart1.Series["Gauss"].ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Column;
NextGaussian(sr, od);
}
private void NextGaussian(double mean, double stdDev)
{
for (double i = 3 - 2 * 3; i <= 3; i = i + 0.1)
{
var r_normalny = (1 / (stdDev * Math.Sqrt(2 * pi)) * Math.Pow(e, ((-(i - mean) * (i - mean)) / 2 * (stdDev * stdDev))));
chart1.Series["Gauss"].Points.AddXY(i, r_normalny);
}
}
}
}
但我不知道它是否有效..而且我对累积分布有疑问。我找到了计算这个的公式,但没有任何效果..
我做过这样的东西。我添加了所有变量以进行更改。泊松分布的正态、累积。完美运行。