예제 #1
0
        private UncertainMeasurementSample CreateDataSet(Interval r, Func <double, double> fv, Func <double, double> fu, int n, int seed)
        {
            UncertainMeasurementSample set = new UncertainMeasurementSample();

            UniformDistribution xd = new UniformDistribution(r);

            Random rng = new Random(seed);

            for (int i = 0; i < n; i++)
            {
                double             x  = xd.InverseLeftProbability(rng.NextDouble());
                double             ym = fv(x);
                double             ys = fu(x);
                NormalDistribution yd = new NormalDistribution(ym, ys);
                double             y  = yd.InverseLeftProbability(rng.NextDouble());

                //Console.WriteLine("{0}, {1}", x, new UncertainValue(y, ys));
                UncertainMeasurement <double> point = new UncertainMeasurement <double>(x, y, ys);
                set.Add(point);
            }

            return(set);
        }