private void sine_modultaion(object sender, RoutedEventArgs e)
        {
            string amp  = amplitude.Text;
            string phs  = phase.Text;
            string freq = round_freq.Text;

            number = Convert.ToDouble(amp);
            phi    = Convert.ToDouble(phs);
            w      = Convert.ToDouble(freq);
            this.Close();
            Oscillogram = new oscillogram {
                Height = 300, Width = 250
            };
            Oscillogram.Show();


            List <double> modulation_values = new List <double>();

            for (int i = 0; i <= number; i++)
            {
                cycle_value = number * Math.Sin(i * w + phi);
                modulation_values.Add(cycle_value);
            }

            int       k    = 1;
            TextBlock name = new TextBlock();

            Grid.SetRow(name, k);
            CartesianChart ch = new CartesianChart();

            ch.Series = new SeriesCollection
            {
                new LineSeries
                {
                    LineSmoothness    = 2,
                    StrokeThickness   = 2,
                    DataLabels        = false,
                    Fill              = Brushes.Transparent,
                    PointGeometrySize = 0,
                    Values            = new ChartValues <double>(modulation_values),
                }
            };


            RowDefinition rowDef = new RowDefinition();
            TextBlock     text   = new TextBlock();

            Oscillogram.oscil.RowDefinitions.Add(rowDef);
            Grid.SetRow(ch, k);

            Oscillogram.oscil.Children.Add(ch);

            Grid.SetRow(text, k);

            Oscillogram.oscil.Children.Add(text);
        }
        private void square_modultaion(object sender, RoutedEventArgs e)
        {
            //string str = square_value.Text;
            //string period = square_period_value.Text;
            //number = Convert.ToDouble(str);
            //L = Convert.ToDouble(period);

            this.Close();
            Oscillogram = new oscillogram {
                Height = 300, Width = 250
            };
            Oscillogram.Show();

            List <double> modulation_values = new List <double>();

            for (int i = 0; i <= number; i++)
            {
                cycle_value = Math.Sign(Math.Sin(i) % L);
                modulation_values.Add(cycle_value);
            }

            int       k    = 1;
            TextBlock name = new TextBlock();

            Grid.SetRow(name, k);
            CartesianChart ch = new CartesianChart();

            ch.Series = new SeriesCollection
            {
                new LineSeries
                {
                    LineSmoothness    = 0,
                    StrokeThickness   = 2,
                    DataLabels        = false,
                    Fill              = Brushes.Transparent,
                    PointGeometrySize = 0,
                    Values            = new ChartValues <double>(modulation_values),
                }
            };


            RowDefinition rowDef = new RowDefinition();
            TextBlock     text   = new TextBlock();

            Oscillogram.oscil.RowDefinitions.Add(rowDef);
            Grid.SetRow(ch, k);

            Oscillogram.oscil.Children.Add(ch);

            Grid.SetRow(text, k);

            Oscillogram.oscil.Children.Add(text);
        }