Bird
Raised Fist0
Signal Processingdata~10 mins

Continuous-time vs discrete-time signals in Signal Processing - Interactive Practice

Choose your learning style10 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a continuous-time signal using a sine wave.

Signal Processing
import numpy as np
import matplotlib.pyplot as plt

t = np.linspace(0, 1, 1000)
x = np.sin(2 * np.pi * 5 * [1])
plt.plot(t, x)
plt.title('Continuous-time signal')
plt.show()
Drag options to blanks, or click blank then click option'
A5
Bnp.arange(0, 1, 0.01)
Cnp.linspace(0, 1, 10)
Dt
Attempts:
3 left
💡 Hint
Common Mistakes
Using a discrete array like np.arange instead of continuous time vector.
Using a constant number instead of the time variable.
2fill in blank
medium

Complete the code to create a discrete-time signal sampled from a sine wave.

Signal Processing
import numpy as np
import matplotlib.pyplot as plt

n = np.arange(0, 50)
x = np.sin(2 * np.pi * 0.1 * [1])
plt.stem(n, x)
plt.title('Discrete-time signal')
plt.show()
Drag options to blanks, or click blank then click option'
An
Bnp.linspace(0, 1, 50)
Cnp.arange(0, 1, 0.1)
D50
Attempts:
3 left
💡 Hint
Common Mistakes
Using continuous time vectors instead of discrete indices.
Using a constant number instead of the time index.
3fill in blank
hard

Fix the error in the code to correctly plot a discrete-time signal.

Signal Processing
import numpy as np
import matplotlib.pyplot as plt

n = np.arange(0, 20)
x = np.sin(2 * np.pi * 0.2 * n)
plt.plot(n, [1])
plt.title('Discrete-time signal')
plt.show()
Drag options to blanks, or click blank then click option'
An
Bx
Cnp.linspace(0, 1, 20)
Dnp.sin(n)
Attempts:
3 left
💡 Hint
Common Mistakes
Plotting the time indices instead of the signal values.
Using a different function call argument.
4fill in blank
hard

Fill both blanks to create a dictionary mapping discrete time indices to signal values for samples greater than 0.5.

Signal Processing
n = np.arange(0, 30)
x = np.sin(2 * np.pi * 0.1 * n)
samples = { [1]: [2] for [1] in n if x[[1]] > 0.5 }
Drag options to blanks, or click blank then click option'
Ai
Bx[i]
Cn
Dx[n]
Attempts:
3 left
💡 Hint
Common Mistakes
Using the whole array n as a key instead of an index.
Using x[n] which is the whole array instead of a single value.
5fill in blank
hard

Fill all three blanks to create a dictionary of squared signal values for discrete times where the signal is positive.

Signal Processing
n = np.arange(0, 40)
x = np.sin(2 * np.pi * 0.05 * n)
squared_positive = { [1]: [2]**2 for [1] in n if [3] > 0 }
Drag options to blanks, or click blank then click option'
Ak
Bx[k]
Dn
Attempts:
3 left
💡 Hint
Common Mistakes
Using the whole array n as a key.
Checking condition on the wrong variable.
Not squaring the signal value.

Practice

(1/5)
1. Which of the following best describes a continuous-time signal?
easy
A. A signal defined only at specific time points
B. A signal that is always zero
C. A signal that only takes integer values
D. A signal defined for every instant of time

Solution

  1. Step 1: Understand continuous-time signal definition

    A continuous-time signal is defined for every instant in time, meaning it varies smoothly without gaps.
  2. Step 2: Compare with discrete-time signals

    Discrete-time signals are defined only at specific time points, not continuously.
  3. Final Answer:

    A signal defined for every instant of time -> Option D
  4. Quick Check:

    Continuous-time = defined at all times [OK]
Hint: Continuous means all time points included [OK]
Common Mistakes:
  • Confusing continuous with discrete signals
  • Thinking discrete signals are continuous
  • Assuming continuous signals only take integer values
2. Which syntax correctly represents a discrete-time signal sampled from a continuous signal x(t) at integer times n?
easy
A. x[n] = integral of x(t)
B. x(n) = x(t) for all t
C. x[n] = x(t) at t = n
D. x(t) = x[n] for n in integers

Solution

  1. Step 1: Identify discrete-time signal notation

    Discrete-time signals use square brackets [n] to denote samples at integer times.
  2. Step 2: Match sampling definition

    Sampling means taking values of x(t) at specific times t = n, so x[n] = x(t) at t = n is correct.
  3. Final Answer:

    x[n] = x(t) at t = n -> Option C
  4. Quick Check:

    Discrete-time uses square brackets and samples at integers [OK]
Hint: Discrete signals use square brackets for indexing [OK]
Common Mistakes:
  • Using parentheses instead of square brackets for discrete signals
  • Confusing continuous and discrete notation
  • Thinking sampling is an integral operation
3. Given the continuous-time signal x(t) = 2t, what is the discrete-time signal x[n] sampled at integer times?
medium
A. x[n] = 2n
B. x[n] = 2t
C. x[n] = n/2
D. x[n] = 2

Solution

  1. Step 1: Understand sampling at integer times

    Sampling means replacing t by integer n in x(t).
  2. Step 2: Substitute t = n in x(t) = 2t

    We get x[n] = 2n.
  3. Final Answer:

    x[n] = 2n -> Option A
  4. Quick Check:

    Replace t with n in formula [OK]
Hint: Replace t with n for discrete samples [OK]
Common Mistakes:
  • Leaving t as variable in discrete signal
  • Dividing instead of multiplying by 2
  • Confusing n and t variables
4. Identify the error in this discrete-time signal definition: x[n] = x(t) at t = n + 0.5
medium
A. The notation x[n] is incorrect
B. Sampling at non-integer times is invalid for discrete-time signals
C. The signal should be continuous, not discrete
D. There is no error; this is a valid discrete-time signal

Solution

  1. Step 1: Understand discrete-time signal sampling points

    Discrete-time signals are defined at integer time points n.
  2. Step 2: Check sampling time t = n + 0.5

    Sampling at half-integers is not standard discrete-time sampling; it breaks the integer indexing rule.
  3. Final Answer:

    Sampling at non-integer times is invalid for discrete-time signals -> Option B
  4. Quick Check:

    Discrete-time = integer time samples only [OK]
Hint: Discrete-time signals sample only integer times [OK]
Common Mistakes:
  • Thinking discrete signals can sample at any time
  • Confusing notation with error
  • Assuming half-integers are valid discrete points
5. You have a continuous-time signal x(t) = sin(2πt). You sample it at 1 Hz (once per second). Which discrete-time signal x[n] do you get, and what is a potential problem?
hard
A. x[n] = sin(2πn); signal appears constant at zero
B. x[n] = sin(2πn); signal is perfectly captured
C. x[n] = sin(πn); signal is undersampled
D. x[n] = sin(4πn); signal is oversampled

Solution

  1. Step 1: Write discrete-time signal from sampling

    Sampling at 1 Hz means t = n seconds, so x[n] = sin(2πn).
  2. Step 2: Evaluate sin(2πn) for integer n

    Since sin(2πn) = 0 for all integers n, the sampled signal is always zero.
  3. Step 3: Identify the problem

    This is an example of aliasing where the sampled signal loses information and appears constant.
  4. Final Answer:

    x[n] = sin(2πn); signal appears constant at zero -> Option A
  5. Quick Check:

    Sampling frequency equals signal frequency causes zero samples [OK]
Hint: Sampling at signal period causes zero values [OK]
Common Mistakes:
  • Assuming sampling always captures signal perfectly
  • Ignoring aliasing effects
  • Confusing frequency and sampling rate
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard