Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to compute the Z-transform of a sequence.
Signal Processing
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)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '*' instead of '**' causes a multiplication error.
Using '+' or '-' changes the meaning and causes wrong results.
✗ Incorrect
The Z-transform uses powers of z, so we raise z to the power n using '**'.
2fill in blank
mediumComplete the code to check if the magnitude of z is inside the region of convergence (ROC).
Signal Processing
z = 0.5 + 0.5j roc_radius = 1.0 if abs(z) [1] roc_radius: print('Inside ROC') else: print('Outside ROC')
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' reverses the condition and gives wrong results.
Using '==' is too strict and rarely true.
✗ Incorrect
The ROC includes points where the magnitude of z is less than the radius.
3fill in blank
hardFix the error in the code to compute the ROC for a causal sequence with pole at p.
Signal Processing
p = 0.8 roc = {z for z in np.linspace(0, 2, 100) if abs(z) [1] abs(p)} print(len(roc))
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '<' selects inside the pole, which is incorrect for causal sequences.
Using '<=' or '>=' changes the boundary inclusion incorrectly.
✗ Incorrect
For a causal sequence, the ROC is outside the pole, so |z| > |p|.
4fill in blank
hardFill both blanks to create a dictionary of z values and their ROC status for a pole at p.
Signal Processing
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)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using '>' in the first blank reverses the ROC condition.
Using '<=' or '>=' changes the strictness of the condition incorrectly.
✗ Incorrect
We check if |z| < |p| for inside ROC and filter z > 0 to avoid zero or negative values.
5fill in blank
hardFill all three blanks to create a dictionary comprehension that maps z to magnitude and ROC status for poles p1 and p2.
Signal Processing
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)
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Reversing inequalities causes wrong ROC classification.
Not filtering positive z values includes zero or negatives.
✗ Incorrect
The ROC is between poles, so |z| < |p1| and |z| <= |p2|, filtering z > 0.