Complete the code to compute the Z-transform of a unit step sequence.
import sympy as sp z = sp.symbols('z') n = sp.symbols('n', integer=True, nonnegative=True) x = sp.Heaviside(n) X = sp.summation(x * z**(-n), (n, 0, sp.oo)) result = X # Result is [1]
The Z-transform of the unit step sequence u[n] is 1 / (1 - z-1) for |z| > 1.
Complete the code to find the Z-transform of the sequence x[n] = a^n u[n].
a = sp.symbols('a') x = a**n * sp.Heaviside(n) X = sp.summation(x * z**(-n), (n, 0, sp.oo)) result = X # Result is [1]
The Z-transform of x[n] = an u[n] is 1 / (1 - a z-1) for |z| > |a|.
Fix the error in the code to compute the Z-transform of the sequence x[n] = delta[n - k].
k = sp.symbols('k', integer=True, nonnegative=True) x = sp.KroneckerDelta(n - k) X = sp.summation(x * z**(-n), (n, 0, sp.oo)) result = X # Result should be [1]
The Z-transform of delta[n - k] is z-k.
Fill both blanks to compute the Z-transform of x[n] = n * a^n * u[n].
x = n * a**n * sp.Heaviside(n) X = sp.summation(x * z**(-n), (n, 0, sp.oo)) result = [1] / ([2])**2
The Z-transform of n an u[n] is (a z-1) / (1 - a z-1)2.
Fill all three blanks to compute the Z-transform of x[n] = cos(Ďâ n) u[n].
omega0 = sp.symbols('omega0', real=True) x = sp.cos(omega0 * n) * sp.Heaviside(n) X = sp.summation(x * z**(-n), (n, 0, sp.oo)) result = ([1] - [2] * z**-1) / (1 - 2 * [3] * z**-1 + z**-2)
The Z-transform of cos(Ďâ n) u[n] is (z - cos(Ďâ) z-1) / (1 - 2 cos(Ďâ) z-1 + z-2).
