Exemplo n.º 1
0
        /// <summary>
        /// Does simple amplitude demodulation of <paramref name="signal"/> based on Hilbert transform.
        /// </summary>
        public static DiscreteSignal DemodulateAmplitude(DiscreteSignal signal)
        {
            var ht  = new HilbertTransform(signal.Length);
            var mag = ht.AnalyticSignal(signal.Samples).Magnitude;

            return(new DiscreteSignal(signal.SamplingRate, mag.ToFloats()) - 1.0f);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Does simple frequency demodulation pf <paramref name="signal"/> based on Hilbert transform.
        /// </summary>
        public static DiscreteSignal DemodulateFrequency(DiscreteSignal signal)
        {
            var diff = new float[signal.Length];

            MathUtils.Diff(signal.Samples, diff);

            var ht  = new HilbertTransform(signal.Length);
            var mag = ht.AnalyticSignal(diff).Magnitude;

            return(new DiscreteSignal(signal.SamplingRate, mag.ToFloats()) - 1.0f);
        }