コード例 #1
0
        private void DrawHistogram()
        {
            //plot.AddLine("Hist10", OxyColors.Black);
            //for(int i = 0; i < hist10.Length; i++) {
            //    if(hist10[i]>0)plot.AddPoint(i,hist10[i]);
            //}
            for (int j = 1; j < 35; j += 5)
            {
                byte c = (byte)(j * 5);
                plot.AddLine("Hist (N=" + j * 10 + ")", OxyColor.FromRgb(c, c, c));
                for (int i = 0; i < 1500; i++)
                {
                    if (hist[j, i] > 0)
                    {
                        plot.AddPoint(i, hist[j, i]);
                    }
                }
            }
            int x = 34;

            plot.AddLine("Hist" + x * 10, OxyColors.Red);
            for (int i = 0; i < 1500; i++)
            {
                if (hist[x, i] > 0)
                {
                    plot.AddPoint(i, hist[x, i]);
                }
            }
        }
コード例 #2
0
 public Sampler(MainWindowModel mw)
 {
     this.window = mw;
     rwplot      = new RandomWalkPlot(window.Plot1, "Sampling Gauss/Cauchy ", "");
     for (int i = 0; i < N; i++)
     {
         samples[0, i] = cauchyRandom();
         samples[1, i] = gaussRandom();
     }
     Console.WriteLine(samples[0, 2]);
     rwplot.AddLine("Cauchy", OxyColors.Blue);
     for (int i = 0; i < N; i++)
     {
         double mean = 0;
         for (int j = 0; j < i; j++)
         {
             mean = mean + samples[0, j];
         }
         rwplot.AddPoint(i, mean / i);
     }
     rwplot.AddLine("Gauss", OxyColors.Red);
     for (int i = 0; i < N; i++)
     {
         double mean = 0;
         for (int j = 0; j < i; j++)
         {
             mean = mean + samples[1, j];
         }
         rwplot.AddPoint(i, mean / i);
     }
 }