Exemple #1
0
 public void InitializeParser()
 {
     parser             = new Parser.Parser();
     parser.InputString = "(1/exp(i/(N/D)))/M";
     VariableN          = parser.GetVariable("n");
     VariableI          = parser.GetVariable("i");
     VariableD          = parser.GetVariable("d");
     VariableM          = parser.GetVariable("m");
     VariableM.value    = 5;
     VariableD.value    = 3;
 }
        private void goButton_Click(object sender, RoutedEventArgs e)
        {
            Parser.Parser.Variable variableI;
            Parser.Parser parser = new Parser.Parser();

            parser = new Parser.Parser();
            parser.InputString = functionTextBox.Text;
            variableI = parser.GetVariable("x");

            PointCollection p = new PointCollection();

            Random r = new Random();

            for (float i = 0; i <= 10; i += 0.5f)
            {
                points.pointX.Add(i);
                variableI.value = i;
                clearSignal.Add(variableI.value);

                //variableI.value = (i % 3 == 0) ? i * (float)r.NextDouble() : i;
                //noiseSignal.Add(variableI.value);
                points.pointY.Add(parser.Calculate());
                p.Add(new Point(parser.Calculate(), i));
            }

            chart.DataContext = p;
        }
        private void goButton_Click(object sender, RoutedEventArgs e)
        {
            Parser.Parser.Variable VariableI;
            Parser.Parser parser = new Parser.Parser();

            parser = new Parser.Parser();
            parser.InputString = FunctionBox.Text;
            VariableI = parser.GetVariable("x");

            PointCollection p = new PointCollection();

            for (float i = 0; i < 10; i += 0.5f)
            {
                VariableI.value = i;
                p.Add(new Point(parser.Calculate(), i));
            }

            chart.DataContext = p;
        }