Lesson 1 of 15

Sinusoids

Sinusoids

The sinusoid is the fundamental building block of signal processing. Every real-world signal — audio, radio, seismic — can be decomposed into a sum of sinusoids by the Fourier theorem.

The Sinusoidal Signal

A continuous sinusoidal signal is described by:

x(t)=Asin(2πft+ϕ)x(t) = A \sin(2\pi f t + \phi)

where:

  • AA = amplitude (peak value)
  • ff = frequency in Hz (cycles per second)
  • tt = time in seconds
  • ϕ\phi = phase offset in radians

Angular Frequency

It is often convenient to write the angular frequency:

ω=2πf(radians per second)\omega = 2\pi f \quad \text{(radians per second)}

so the signal becomes x(t)=Asin(ωt+ϕ)x(t) = A \sin(\omega t + \phi).

Example

A 440 Hz sinusoid (concert A) with amplitude 1 and zero phase:

x(t)=sin(2π440t)x(t) = \sin(2\pi \cdot 440 \cdot t)

At t=1/1760t = 1/1760 seconds (quarter cycle), x=sin(π/2)=1.0x = \sin(\pi/2) = 1.0 — the peak.

Your Task

Implement:

  • sinusoid(A, f, t, phi=0) — returns Asin(2πft+ϕ)A \sin(2\pi f t + \phi)
  • angular_frequency(f) — returns ω=2πf\omega = 2\pi f
import math

def sinusoid(A, f, t, phi=0):
    return A * math.sin(2 * math.pi * f * t + phi)

def angular_frequency(f):
    return 2 * math.pi * f

# 440 Hz sine at t=0 (zero crossing)
print(round(sinusoid(1.0, 440.0, 0.0), 4))   # 0.0
# At quarter period: t = 1/(4*440)
print(round(sinusoid(1.0, 440.0, 1/1760), 4)) # 1.0
print(round(angular_frequency(60.0), 4))       # 376.9911
Python runtime loading...
Loading...
Click "Run" to execute your code.