예제 #1
0
        public DoubleSeries GenerateEEG(int count, ref double startPhase, double phaseStep)
        {
            var doubleSeries = new DoubleSeries();
            var rand         = new Random((int)DateTime.Now.Ticks);

            for (int i = 0; i < count; i++)
            {
                var xyPoint = new XYPoint();

                var time = i / (double)count;
                xyPoint.X = time;
                //double mod = 0.2 * Math.Sin(startPhase);
                xyPoint.Y = //mod * Math.Sin(startPhase / 4.9) +
                            0.05 * (rand.NextDouble() - 0.5) +
                            1.0;

                doubleSeries.Add(xyPoint);
                startPhase += phaseStep;
            }

            return(doubleSeries);
        }
예제 #2
0
        public DoubleSeries GetSquirlyWave()
        {
            var doubleSeries = new DoubleSeries();
            var rand         = new Random((int)DateTime.Now.Ticks);

            const int COUNT = 1000;

            for (int i = 0; i < COUNT; i++)
            {
                var xyPoint = new XYPoint();

                var time = i / (double)COUNT;
                xyPoint.X = time;
                xyPoint.Y = time * Math.Sin(2 * Math.PI * i / (double)COUNT) +
                            0.2 * Math.Sin(2 * Math.PI * i / (COUNT / 7.9)) +
                            0.05 * (rand.NextDouble() - 0.5) +
                            1.0;

                doubleSeries.Add(xyPoint);
            }

            return(doubleSeries);
        }
예제 #3
0
        public DoubleSeries GetFourierSeries(double amplitude, double phaseShift, int count = 5000)
        {
            var doubleSeries = new DoubleSeries();

            for (int i = 0; i < count; i++)
            {
                var xyPoint = new XYPoint();

                double time = 10 * i / (double)count;
                double wn   = 2 * Math.PI / (count / 10);

                xyPoint.X = time;
                xyPoint.Y = Math.PI * amplitude *
                            (Math.Sin(i * wn + phaseShift) +
                             0.33 * Math.Sin(i * 3 * wn + phaseShift) +
                             0.20 * Math.Sin(i * 5 * wn + phaseShift) +
                             0.14 * Math.Sin(i * 7 * wn + phaseShift) +
                             0.11 * Math.Sin(i * 9 * wn + phaseShift) +
                             0.09 * Math.Sin(i * 11 * wn + phaseShift));
                doubleSeries.Add(xyPoint);
            }

            return(doubleSeries);
        }