Beispiel #1
0
 protected override void FillList()
 {
     for (float i = 0.1f; i < Math.Abs(inpFunction.Right - inpFunction.Left); i += 1f)
     {
         FunctionFromTask fft = new FunctionFromTask();
         fft.Left       = inpFunction.Left;
         fft.Right      = inpFunction.Right;
         fft.QuantumAbs = i;
         fft.QuantumOrd = inpFunction.QuantumOrd;
         fft.OnlyResult = true;
         fft.Build();
         KotelnikovFunction kf = new KotelnikovFunction(fft);
         kf.OnlyResult = true;
         kf.Build();
         KotelnikovFunction kf2 = new KotelnikovFunction(kf);
         kf2.OnlyResult = true;
         kf2.QuantumAbs = 0.4f;
         kf2.Build();
         SquareAproximationMistakeFunction aprox = new SquareAproximationMistakeFunction(kf2)
         {
             OnlyResult = true
         };
         aprox.Build();
         var sum = aprox.Sum(a => Math.Abs(a.Y));
         OnNewPoint(this, new FuncEventArgs(new System.Drawing.PointF(i, sum)));
     }
 }
Beispiel #2
0
        public void tabFormControl1_SelectedPageChanged(object sender, TabFormSelectedPageChangedEventArgs e)
        {
            if (e.Page == FunctionDiscret)
            {
                var func = FuncAnalog.internalDrawList.Find((a) => { return((string)a.Series.Tag == typeof(FunctionFromTask).Name); });
                if (func == null || FuncDiscretn.Equals(func))
                {
                    return;
                }
                FunctionFromTaskQuantum fc = new FunctionFromTaskQuantum(func);
                fc.QuantumOrd = func.QuantumOrd;
                func.DestroySeries();
                FuncDiscretn.AddFunc(fc);
                //FuncDiscretn.AddFunc(func);
                //func.OnlyResult = true;
                KotelnikovFunction kf = new KotelnikovFunction(func);
                //kf.OnlyResult = true;
                //kf.Build();
                //KotelnikovSmooth ks = new KotelnikovSmooth(kf);
                FuncDiscretn.AddFunc(kf);

                FuncDiscretn.DrawFunc();
            }
            if (e.Page == FunctionACH)
            {
                var func = FuncDiscretn.internalDrawList.Find((a) => { return((string)a.Series.Tag == typeof(FunctionFromTaskQuantum).Name); });
                if (func == null || FuncAch.Equals(func))
                {
                    return;
                }
                var func1 = FuncAnalog.internalDrawList.Find((a) => { return((string)a.Series.Tag == typeof(FunctionFromTask).Name); });
                if (func1 == null)
                {
                    return;
                }
                ACHFunction fun  = new ACHFunction(func);
                ACHFunction fun1 = new ACHFunction(func1);
                FuncAch.AddFunc(fun1);
                FuncAch.AddFunc(fun);
                FCHFunction ffun = new FCHFunction(func);
                FuncAch.AddFunc(ffun);
                FCHFunction ffun1 = new FCHFunction(func1);
                FuncAch.AddFunc(ffun1);
                FuncAch.DrawFunc();
            }
            if (e.Page == FunctionMistakes)
            {
                var func = (KotelnikovFunction)FuncDiscretn.internalDrawList.Find((a) => { return((string)a.Series.Tag == typeof(KotelnikovFunction).Name); });
                if (func == null)
                {
                    return;
                }
                //func.Series.ChangeView(ViewType.Spline);

                //func.DestroySeries();

                SquareAproximationMistakeFunction apx = new SquareAproximationMistakeFunction(func);

                //FuncMistakes.AddFunc(func);
                FuncMistakes.AddFunc(apx);
                FuncMistakes.DrawFunc();
            }
            if (e.Page == FunctionQMistake)
            {
                var funcan = FuncAnalog.internalDrawList.Find((a) => { return((string)a.Series.Tag == typeof(FunctionFromTask).Name); });
                if (funcan == null)
                {
                    return;
                }
                FunctionQuantMistake fq = new FunctionQuantMistake(funcan);
                FuncQMistake.AddFunc(fq);
                FuncQMistake.DrawFunc();
            }
        }