Esempio n. 1
0
        private void comboSignalsAprox_SelectedIndexChanged(object sender, EventArgs e)
        {
            var comboBox = sender as ComboBox;
            string key = comboBox.SelectedItem.ToString();
            zedAprox.GraphPane.CurveList.Clear();
            var line = new LineItem(key, KursCurves[key], Color.Blue, SymbolType.None);
            zedAprox.GraphPane.CurveList.Add(line);
            if (KursCurves.ContainsKey(aproxLine))
            {
                KursCurves.Remove(aproxLine);
            }
            zedAprox.AxisChange();
            zedAprox.Refresh();

            var Wawe = new CWaweTransform();
            var Signal = new List<double>();
            foreach (PointPair p in KursCurves[comboSignalsAprox.SelectedItem.ToString()])
            {
                Signal.Add(p.Y);
            }
            CDecomposition D = Wawe.Decompose(Signal, 11, 2);
            D.Approx[0] = 0;
            D.DeNoise(Convert.ToDouble(textNoise.Text));
            Signal = Wawe.Reconstruct(D);

            comboDeepness.Items.Clear();
            int J = -1;
            for (int i = 1; i <= 15; i++)
            {
                J = i;
                if (Math.Pow(2, i) == Signal.Count)
                    break;
                comboDeepness.Items.Add(i);
            }
            comboDeepness.SelectedIndex = 0;
        }
Esempio n. 2
0
        private void btnAprox_Click(object sender, EventArgs e)
        {
            try
            {
                var Wawe = new CWaweTransform();
                var Signal = new List<double>();
                foreach (PointPair p in KursCurves[comboSignalsAprox.SelectedItem.ToString()])
                {
                    Signal.Add(p.Y);
                }
                ASignal = Wawe.GetAproxKoef(Signal, comboWaweOrderAprox.SelectedIndex + 1,
                                            comboDeepness.SelectedIndex + 1);

                if (!KursCurves.ContainsKey(aproxLine))
                {
                    KursCurves.Add(aproxLine, new PointPairList());
                    zedAprox.GraphPane.CurveList.Add(new LineItem(aproxLine, KursCurves[aproxLine], Color.Red,
                                                                  SymbolType.Circle));
                }
                KursCurves[aproxLine].Clear();
                double dt = Signal.Count/ASignal.Count;
                for (int t = 0; t < ASignal.Count; t++)
                {
                    //curveAAA.AddPoint((t * dt+(t+1)*dt)/2, Math.Pow(A.Count, 0.5) * A[t]);

                    KursCurves[aproxLine].Add(t*dt, Math.Pow(ASignal.Count, 0.5)*ASignal[t]);
                }
                //zedAprox.GraphPane.XAxis.Scale.Max = Signal.Count;
                zedAprox.AxisChange();
                zedAprox.Invalidate();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.Source, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }