Esempio n. 1
0
        public override IEnumerable <double> GetValues()
        {
            var skipSignal = signal.GetValues().Skip(Start % signal.GetLength());

            for (var rest = Duration; rest > 0; rest--)
            {
                yield return(skipSignal.First());

                skipSignal = (skipSignal.Any()) ? skipSignal.Skip(1) : signal.GetValues();
            }
        }
Esempio n. 2
0
        public Spectrum GetSpectrum(ISignal signal)
        {
            var specArr = transformer.Transform(signal.GetValues().ToArray());
            var len     = (double)specArr.Length;
            var dur     = signal.GetDurationInSeconds();


            var points = specArr
                         .Select((val, idx) => new FreqPoint(val, len / idx * dur))
                         .ToArray();

            return(new Spectrum(new SpectrumLine[] { new SpectrumLine(points, 0) }));
        }
Esempio n. 3
0
        public Complex CalcFreq(ISignal signal, double w)
        {
            var mc = Complex.Zero;
            var i  = 0;

            foreach (var val in signal.GetValues())
            {
                mc += Complex.FromPolarCoordinates(val, -i * w * 2 * Math.PI / signal.GetLength());
                i++;
                //Logger.DEFLOG.WriteLog(String.Format("val: {0};", val));
            }
            //Logger.DEFLOG.Flush();

            return(mc);
        }