Complete the code to compute the Z-transform of a sequence.
import numpy as np x = [1, 2, 3] z = np.array([1, -1j, 1j]) X = sum(x[n] * z[1]n for n in range(len(x))) print(X)
Complete the code to check if the magnitude of z is inside the region of convergence (ROC).
z = 0.5 + 0.5j roc_radius = 1.0 if abs(z) [1] roc_radius: print('Inside ROC') else: print('Outside ROC')
Fix the error in the code to compute the ROC for a causal sequence with pole at p.
p = 0.8 roc = {z for z in np.linspace(0, 2, 100) if abs(z) [1] abs(p)} print(len(roc))
Fill both blanks to create a dictionary of z values and their ROC status for a pole at p.
p = 0.6 z_values = np.linspace(0, 1.5, 10) roc_dict = {z: 'inside' if abs(z) [1] abs(p) else 'outside' for z in z_values if z [2] 0} print(roc_dict)
Fill all three blanks to create a dictionary comprehension that maps z to magnitude and ROC status for poles p1 and p2.
p1, p2 = 0.5, 1.2 z_vals = np.linspace(0, 2, 15) roc_info = {z: (abs(z), 'inside' if abs(z) [1] abs(p1) and abs(z) [2] abs(p2) else 'outside') for z in z_vals if z [3] 0} print(roc_info)
