Exemple #1
0
        public static SygnalCiagly ReadFromFile(string name)
        {
            IFormatter   formatter = new BinaryFormatter();
            Stream       stream    = new FileStream(name, FileMode.Open, FileAccess.Read, FileShare.Read);
            SygnalCiagly obj       = (SygnalCiagly)formatter.Deserialize(stream);

            obj.FromTimeAndAmplitudeToPoints(obj.Points, obj.TimeAndAmplitude);
            obj.FromTimeAndAmplitudeToPoints(obj.Points2, obj.TimeAndAmplitude2);
            stream.Close();
            return(obj);
        }
Exemple #2
0
        public static SygnalCiagly Divide(SygnalCiagly x, SygnalCiagly y)
        {
            ICollection <Point> newPoints = new Collection <Point>();

            for (int i = 0; i < x.TimeAndAmplitude.Count(); i++)
            {
                double iloraz;
                if (y.TimeAndAmplitude.ElementAt(i).Y == 0)
                {
                    iloraz = 0;
                }
                else
                {
                    iloraz = x.TimeAndAmplitude.ElementAt(i).Y / y.TimeAndAmplitude.ElementAt(i).Y;
                }
                newPoints.Add(new Point(x.TimeAndAmplitude.ElementAt(i).X, iloraz));
            }
            ICollection <Point> newPoints2 = new Collection <Point>();

            for (int i = 0; i < x.TimeAndAmplitude2.Count(); i++)
            {
                double iloraz;
                if (y.TimeAndAmplitude2.ElementAt(i).Y == 0)
                {
                    iloraz = 0;
                }
                else
                {
                    iloraz = x.TimeAndAmplitude2.ElementAt(i).Y / y.TimeAndAmplitude2.ElementAt(i).Y;
                }
                newPoints2.Add(new Point(x.TimeAndAmplitude2.ElementAt(i).X, iloraz));
            }
            SygnalCiagly wynik = new SygnalCiagly(0, 0, 0, 0, 0, 0, 0, 0);

            wynik.TimeAndAmplitude = newPoints;
            wynik.FromTimeAndAmplitudeToPoints(wynik.Points, wynik.TimeAndAmplitude);
            wynik.TimeAndAmplitude2 = newPoints2;
            wynik.FromTimeAndAmplitudeToPoints(wynik.Points2, wynik.TimeAndAmplitude2);
            wynik.CalculateInfo();
            return(wynik);
        }
Exemple #3
0
        public static SygnalCiagly Muliply(SygnalCiagly x, SygnalCiagly y)
        {
            ICollection <Point> newPoints = new Collection <Point>();

            for (int i = 0; i < x.TimeAndAmplitude.Count(); i++)
            {
                newPoints.Add(new Point(x.TimeAndAmplitude.ElementAt(i).X, x.TimeAndAmplitude.ElementAt(i).Y *y.TimeAndAmplitude.ElementAt(i).Y));
            }
            ICollection <Point> newPoints2 = new Collection <Point>();

            for (int i = 0; i < x.TimeAndAmplitude2.Count(); i++)
            {
                newPoints2.Add(new Point(x.TimeAndAmplitude2.ElementAt(i).X, x.TimeAndAmplitude2.ElementAt(i).Y *y.TimeAndAmplitude2.ElementAt(i).Y));
            }
            SygnalCiagly wynik = new SygnalCiagly(0, 0, 0, 0, 0, 0, 0, 0);

            wynik.TimeAndAmplitude = newPoints;
            wynik.FromTimeAndAmplitudeToPoints(wynik.Points, wynik.TimeAndAmplitude);
            wynik.TimeAndAmplitude2 = newPoints2;
            wynik.FromTimeAndAmplitudeToPoints(wynik.Points2, wynik.TimeAndAmplitude2);
            wynik.CalculateInfo();
            return(wynik);
        }