Exemplo n.º 1
0
from lcapy import (symbol, texpr, cos, sin, exp,
                   expr, pi, rect, sinc, tri, trap, delta, sign, H, j, t, f)

alpha = symbol('alpha')
t0 = symbol('t0')
f0 = symbol('f0')
w0 = 2 * pi * f0

sigs = [texpr('x(t)'), texpr('x(a * t)'), texpr('x(t - tau)'),
        cos(w0 * t), sin(w0 * t), exp(j * w0 * t),
        texpr(1), t, t**2, 1 / t, delta(t), delta(t - t0),
        H(t), t * H(t), sign(t),
        rect(t), sinc(t), tri(t), trap(t, alpha),
        exp(-abs(t)), exp(-t) * H(t)]

for sig in sigs:
    print(':math:`%s \\longleftrightarrow %s`\n' %
          (sig.latex(), sig(f).latex()))
Exemplo n.º 2
0
from lcapy import delta
from lcapy.discretetime import n, dt
from matplotlib.pyplot import savefig

x = delta(n) + delta(n - 2)
x.DTFT().subs(dt, 1).plot(figsize=(6, 3))

savefig('dt1-DTFT-plot1.png', bbox_inches='tight')
Exemplo n.º 3
0
Arquivo: ODTFTs.py Projeto: mph-/lcapy
alpha = symbol('alpha')
m = symbol('m', integer=True)
W0 = symbol('Omega_0')
No = symbol('N_o', odd=True)
Ne = symbol('N_e', even=True)
K = symbol('K')

sigs = [
    nexpr('x(n)'),
    nexpr('x(a * n)'),
    nexpr('x(n - m)'),
    cos(W0 * n),
    sin(W0 * n),
    exp(j * W0 * n),
    nexpr(1),
    delta(n),
    delta(n - m),
    H(n), n * H(n),
    sign(n), alpha**-n * H(n),
    rect(n),
    rect(n / No),
    rect(n / Ne),
    sinc(n),
    sinc(K * n),
    sinc(K * n)**2,
    sincu(K * n)
]

for sig in sigs:
    print(':math:`%s \\longleftrightarrow %s`\n' %
          (sig.latex(), sig(Omega).latex()))
Exemplo n.º 4
0
from lcapy import symbol, nexpr, delta, cos, sin, exp, H, n, dt, pi, j, z

alpha = symbol('alpha')
p = symbol('p')
a = symbol('a')
f0 = symbol('f0')
w0 = 2 * pi * f0

sigs = [nexpr('x(n)'), nexpr('x(n - m)'),
        cos(w0 * n * dt), sin(w0 * n * dt), exp(j * w0 * n * dt),
        nexpr(1), delta(n), delta(n - p), a**n, a**-n, n * a**n, n * a**-n,
        H(n), exp(-n * dt) * H(n)]

for sig in sigs:
    print(':math:`%s \\longleftrightarrow %s`\n' %
          (sig.latex(), sig(z).latex()))
Exemplo n.º 5
0
from lcapy import (symbol, nexpr, cos, sin, exp, j, sinc,
                   rect, sincu, n, dt, delta, sign, H, pi, f)

alpha = symbol('alpha')
m = symbol('m', integer=True)
f0 = symbol('f0')
w0 = 2 * pi * f0
No = symbol('N_o', odd=True)
Ne = symbol('N_e', even=True)
K = symbol('K')

sigs = [nexpr('x(n)'), nexpr('x(a * n)'), nexpr('x(n - m)'),
        cos(w0 * n * dt), sin(w0 * n * dt), exp(j * w0 * n * dt),
        nexpr(1), delta(n), delta(n - m),
        H(n), n * H(n), sign(n),
        alpha**-n * H(n), rect(n), rect(n / No), rect(n / Ne),
        sinc(n), sinc(K * n), sinc(K * n)**2, sincu(K * n)]

for sig in sigs:
    print(':math:`%s \\longleftrightarrow %s`\n' %
          (sig.latex(), sig(f).latex()))