Ejemplo n.º 1
0
        lag = np.arange(tau_start, tau_end)
    taucol = lag.shape[0]

    n_fbins = init_default_args(signal, n_fbins=n_fbins)[0]

    naf = np.zeros((n_fbins, taucol), dtype=complex)
    for icol in xrange(taucol):
        taui = lag[icol]
        t = np.arange(abs(taui), n - abs(taui))
        naf[t, icol] = signal[t + taui] * np.conj(signal[t - taui])
    naf = np.fft.fft(naf, axis=0)

    _ix1 = np.arange((n_fbins + (n_fbins % 2)) / 2, n_fbins)
    _ix2 = np.arange((n_fbins + (n_fbins % 2)) / 2)

    _xi1 = -(n_fbins - (n_fbins % 2)) / 2
    _xi2 = ((n_fbins + (n_fbins % 2)) / 2 - 1)
    xi = np.arange(_xi1, _xi2 + 1, dtype=float) / n_fbins
    naf = naf[np.hstack((_ix1, _ix2)), :]
    return naf, lag, xi


if __name__ == '__main__':
    from tftb.generators import anabpsk
    sig = anabpsk(256, 8)[0]
    naf, x, y = narrow_band(sig)
    import matplotlib.pyplot as plt
    plt.contour(2 * x, y, np.abs(naf)**2, 16)
    plt.grid(True)
    plt.show()
Ejemplo n.º 2
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.

"""

"""


from tftb.generators import anabpsk
import matplotlib.pyplot as plt
import numpy as np

x, am = anabpsk(300, 30, 0.1)
plt.subplot(211), plt.plot(np.real(x))
plt.grid()
plt.title("Analytic BPSK signal")
plt.subplot(212), plt.plot(am)
plt.grid()
plt.title("Amplitude Modulation")
plt.show()
Ejemplo n.º 3
0
            tau_start, tau_end = -(n - 1) / 2, (n + 1) / 2
        lag = np.arange(tau_start, tau_end)
    taucol = lag.shape[0]

    n_fbins = init_default_args(signal, n_fbins=n_fbins)[0]

    naf = np.zeros((n_fbins, taucol), dtype=complex)
    for icol in range(taucol):
        taui = lag[icol]
        t = np.arange(abs(taui), n - abs(taui))
        naf[t, icol] = signal[t + taui] * np.conj(signal[t - taui])
    naf = np.fft.fft(naf, axis=0)

    _ix1 = np.arange((n_fbins + (n_fbins % 2)) / 2, n_fbins)
    _ix2 = np.arange((n_fbins + (n_fbins % 2)) / 2)

    _xi1 = -(n_fbins - (n_fbins % 2)) / 2
    _xi2 = ((n_fbins + (n_fbins % 2)) / 2 - 1)
    xi = np.arange(_xi1, _xi2 + 1, dtype=float) / n_fbins
    naf = naf[np.hstack((_ix1, _ix2)), :]
    return naf, lag, xi

if __name__ == '__main__':
    from tftb.generators import anabpsk
    sig = anabpsk(256, 8)[0]
    naf, x, y = narrow_band(sig)
    import matplotlib.pyplot as plt
    plt.contour(2 * x, y, np.abs(naf) ** 2, 16)
    plt.grid(True)
    plt.show()
Ejemplo n.º 4
0
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2015 jaidev <jaidev@newton>
#
# Distributed under terms of the MIT license.
"""

"""

from tftb.generators import anabpsk
import matplotlib.pyplot as plt
import numpy as np

x, am = anabpsk(300, 30, 0.1)
plt.subplot(211), plt.plot(np.real(x))
plt.grid()
plt.title('Analytic BPSK signal')
plt.subplot(212), plt.plot(am)
plt.grid()
plt.title('Amplitude Modulation')
plt.show()