Ejemplo n.º 1
0
    def __new__(self, M=10, beta=1, phi=0, normalised=True, inverted=False):

        if not inverted:
            if phi == 0:
                wc = np.kaiser(M, beta)  # Window coefficients
                win = wc / sum(wc)  # Normalised window
            else:
                wc = np.kaiser(M, beta)  # Window coefficients
                m = np.arange(0, M)  # Create M indeces from 0 to 1
                a = exp(-1j * 2 * pi * m * phi)  # Steering vector
                ws = dot(wc, a)  # Normalisation factor
                win = a * wc / ws  # Steered and normalised window
        else:
            if phi == 0:
                wc = 1 / np.kaiser(M, beta)  # Window coefficients
                win = wc / sum(wc)  # Normalised window
            else:
                wc = 1 / np.kaiser(M, beta)  # Window coefficients
                m = np.arange(0, M)  # Create M indeces from 0 to 1
                a = exp(-1j * 2 * pi * m * phi)  # Steering vector
                ws = dot(wc, a)  # Normalisation factor
                win = a * wc / ws  # Steered and normalised window

        w = np.Ndarray.__new__(self, win)
        #                               axes=('M',),
        #                               desc = 'Kaiser (beta=%d, phi=%d)'%(beta,phi))
        #                               shape_desc=('M','1'))
        return w
Ejemplo n.º 2
0
    def __new__(self, M=10, phi=0, normalised=True):

        # Create the window
        if phi == 0:
            win = np.ones((M, ), dtype=None) / M
        else:
            wc = np.ones(M, dtype=complex)  # Window coefficients
            m = np.arange(0, M)  # Create M indeces from 0 to 1
            a = exp(-1j * 2 * pi * m * phi)  # Steering vector
            ws = dot(wc, a)  # Normalisation factor
            win = a * wc / ws  # Steered and normalised window

        w = np.Ndarray.__new__(self, win)
        #                               axes=('M',),
        #                               desc = 'Rectangular (phi=%d)'%phi)
        #                               desc='Rectangular (phi=%d)'%phi,
        #                               shape_desc=('M','1'))
        return w
Ejemplo n.º 3
0
    def __new__(self, M=10, a=0.54, phi=0, normalised=True):

        # Create the window
        if phi == 0:
            wc = a + (1 - a) * np.cos(2 * pi * np.linspace(-0.5, 0.5, M))
            win = wc / sum(wc)  # Normalised window
        else:
            n = np.linspace(-0.5, 0.5, M)
            wc = a + (1 - a) * np.cos(2 * pi * n)  # Window coefficients
            m = np.arange(0, M)  # Create M indeces from 0 to 1
            aa = exp(-1j * 2 * pi * m * phi)  # Steering vector
            ws = dot(wc, aa)  # Normalisation factor
            win = aa * wc / ws  # Steered and normalised window

        w = np.Ndarray.__new__(self, win)
        #                               axes=('M',),
        #                               desc = 'Rectangular (phi=%d)'%phi)
        #                               desc='Rectangular (phi=%d)'%phi,
        #                               shape_desc=('M','1'))
        return w
Ejemplo n.º 4
0
def get_stationary2(A):
    P = np.linalg.matrix_power(A, 10000)
    P_next = np.dot(P, A)
    while not np.allclose(P, P_next):
        P_next = np.dot(P_next, A)
    return P_next[0]