Signals carry information using waves. Amplitude, frequency, and phase help us understand and change these waves.
When analyzing sound waves to understand loudness and pitch.
When working with radio signals to tune into a station.
When creating animations that move smoothly over time.
When measuring heartbeats or brain waves in healthcare.
When designing alarms or alerts with specific tones.
Syntax
Signal Processing
signal(t) = amplitude * sin(2 * pi * frequency * t + phase)
amplitude controls the wave's height (loudness or strength).
frequency controls how fast the wave repeats (pitch or speed).
Examples
A wave with amplitude 5, frequency 10 Hz, and no phase shift.
Signal Processing
signal(t) = 5 * sin(2 * pi * 10 * t + 0)
A wave with amplitude 2, frequency 5 Hz, and phase shifted by 90 degrees.
Signal Processing
signal(t) = 2 * sin(2 * pi * 5 * t + pi/2)
A wave with amplitude 1, frequency 1 Hz, and phase shifted by 180 degrees (inverted wave).
Signal Processing
signal(t) = 1 * sin(2 * pi * 1 * t + pi)
Sample Program
This code creates a wave with amplitude 3, frequency 5 Hz, and phase shift of 45 degrees. It then shows the wave on a graph so you can see how it looks over one second.
Signal Processing
import numpy as np
import matplotlib.pyplot as plt
# Time points from 0 to 1 second, 1000 samples
t = np.linspace(0, 1, 1000)
# Define signal properties
amplitude = 3
frequency = 5# 5 Hz
phase = np.pi / 4# 45 degrees# Create the signal
signal = amplitude * np.sin(2 * np.pi * frequency * t + phase)
# Plot the signal
plt.plot(t, signal)
plt.title('Signal with Amplitude=3, Frequency=5Hz, Phase=45°')
plt.xlabel('Time (seconds)')
plt.ylabel('Signal Amplitude')
plt.grid(True)
plt.show()
OutputSuccess
Important Notes
Amplitude changes how tall the wave is, like turning volume up or down.
Frequency changes how fast the wave repeats, like changing the pitch of a sound.
Phase shifts the wave left or right, changing where it starts.
Summary
Amplitude controls wave height or strength.
Frequency controls how often the wave repeats per second.
Phase shifts the wave's starting point in time.
Practice
(1/5)
1. Which property of a signal describes how tall or strong the wave is?
easy
A. Frequency
B. Amplitude
C. Phase
D. Wavelength
Solution
Step 1: Understand amplitude meaning
Amplitude measures the height or strength of a wave, showing how strong the signal is.
Step 2: Compare with other properties
Frequency is how often the wave repeats, phase shifts the start, wavelength is distance, not height.
Final Answer:
Amplitude -> Option B
Quick Check:
Amplitude = wave height [OK]
Hint: Amplitude means wave height or strength [OK]
Common Mistakes:
Confusing amplitude with frequency
Thinking phase affects height
Mixing wavelength with amplitude
2. Which of the following is the correct way to represent a sine wave with amplitude 3 and frequency 5 Hz in Python using numpy? t = np.linspace(0, 1, 500) y = ?
easy
A. 3 + np.sin(2 * np.pi * 5 * t)
B. np.sin(3 * 2 * np.pi * 5 * t)
C. 3 * np.sin(2 * np.pi * 5 * t)
D. 5 * np.sin(2 * np.pi * 3 * t)
Solution
Step 1: Recall sine wave formula
The sine wave formula is amplitude * sin(2π * frequency * time).
Step 2: Match formula to options
3 * np.sin(2 * np.pi * 5 * t) matches amplitude 3 and frequency 5 correctly as 3 * sin(2π * 5 * t).
Final Answer:
3 * np.sin(2 * np.pi * 5 * t) -> Option C
Quick Check:
Amplitude * sin(2π * frequency * t) [OK]
Hint: Amplitude multiplies sine, frequency inside sine argument [OK]
Common Mistakes:
Multiplying frequency by amplitude inside sine
Adding amplitude instead of multiplying
Swapping amplitude and frequency
3. Given the code: import numpy as np t = np.linspace(0, 1, 5) y = 2 * np.sin(2 * np.pi * 1 * t + np.pi/2) print(np.round(y, 2)) What is the output?
medium
A. [ 2. 0. -2. 0. 2. ]
B. [ 2. 1.41 0. -1.41 -2. ]
C. [ 0. 1.41 2. 1.41 0. ]
D. [ 1.41 2. 1.41 0. -1.41]
Solution
Step 1: Calculate time points
t = [0, 0.25, 0.5, 0.75, 1]
Step 2: Compute y values
y = 2 * sin(2π * 1 * t + π/2) = 2 * cos(2π * t) due to phase shift π/2. Values: 2*cos(0)=2, 2*cos(π/2)=0, 2*cos(π)=-2, 2*cos(3π/2)=0, 2*cos(2π)=2 np.round(y, 2) prints [ 2. 0. -2. 0. 2. ]
Final Answer:
[ 2. 0. -2. 0. 2. ] -> Option A
Quick Check:
Phase π/2 shifts sine to cosine [OK]
Hint: Phase π/2 shifts sine to cosine wave [OK]
Common Mistakes:
Ignoring phase shift
Rounding errors
Mixing sine and cosine values
4. Identify the error in this code snippet that tries to create a sine wave with amplitude 4 and frequency 2 Hz: import numpy as np t = np.linspace(0, 1, 100) y = 4 * np.sin(2 * np.pi * t) * 2
medium
A. The time vector t should be integers, not floats
B. Amplitude should be added, not multiplied
C. np.linspace should use 0 to 2 instead of 0 to 1
D. The frequency multiplier is in the wrong place; it should be inside the sine argument as 2 * np.pi * 2 * t
Solution
Step 1: Analyze sine argument order
The sine argument is 2π * t (frequency 1 Hz), but *2 is outside sin(), incorrectly scaling the amplitude instead of frequency.
Step 2: Correct placement for frequency
Frequency multiplier must be inside sine: 2 * np.pi * 2 * t.
Final Answer:
The frequency multiplier is in the wrong place; it should be inside the sine argument as 2 * np.pi * 2 * t -> Option D
Quick Check:
Frequency must multiply time inside sine [OK]
Hint: Write frequency right after 2π inside sine [OK]
Common Mistakes:
Multiplying amplitude incorrectly
Using wrong time vector type
Changing linspace range unnecessarily
5. You have a signal defined as y = 5 * np.sin(2 * np.pi * 3 * t + π/4). If you want to double the frequency and halve the amplitude while keeping the phase shift the same, which expression is correct?
hard
A. y = 2.5 * np.sin(2 * np.pi * 6 * t + π/4)
B. y = 10 * np.sin(2 * np.pi * 1.5 * t + π/4)
C. y = 2.5 * np.sin(2 * np.pi * 3 * t + π/2)
D. y = 5 * np.sin(2 * np.pi * 6 * t)
Solution
Step 1: Adjust amplitude and frequency
Original amplitude is 5, halved is 2.5. Original frequency is 3, doubled is 6.
Step 2: Keep phase shift same
Phase shift π/4 remains unchanged in the new expression.
Final Answer:
y = 2.5 * np.sin(2 * np.pi * 6 * t + π/4) -> Option A
Quick Check:
Amplitude halved, frequency doubled, phase same [OK]
Hint: Multiply frequency by 2, amplitude by 0.5, keep phase [OK]
Common Mistakes:
Changing phase shift incorrectly
Multiplying amplitude instead of halving
Swapping frequency and amplitude values
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.