Signal generator & scope
Dual-channel waveforms, triggered scope, spectrum, measurements, and export for HIL-style offline work.
Waveforms
- Sine — single spectral line at
f - Square / pulse — odd harmonics; duty sets mark/space
- Triangle / saw — harmonics ~1/n² (triangle) or ~1/n (saw)
- White / pink noise — broadband; pink ≈ −3 dB/octave
- Chirp — linear sweep between start and end frequency
- AM / FM — amplitude or frequency modulation sidebands
- Arbitrary — looped sample table with linear interpolation
x(t) = A · w(φ(t)) + offset
Sampling & Nyquist
Δt = 1 / fₛ content above fₛ/2 aliases
Keep tones well below half the sample rate. The scope timebase (ms/div) chooses how much history is drawn.
Triggering
Rising/falling edge on CH1 re-aligns the display buffer at a threshold crossing — similar in spirit to a real digital scope “auto/normal” capture, simplified for teaching.
FFT spectrum
When the window length is a power of two, a Cooley–Tukey FFT computes the magnitude spectrum. Hann windowing reduces leakage. Peak frequency and a rough THD estimate (harmonics 2…8 over fundamental) are shown.
X[k] = Σₙ x[n] e−j 2π k n / N f_k = k · fₛ / N
Measurements
- Vpp — max − min in the window
- RMS — √(mean x²)
- Freq (est.) — zero-crossing rate (works best on clean periodic signals)
X-Y (Lissajous)
CH1 → X, CH2 → Y. Equal frequencies with 90° phase produce a circle/ellipse; frequency ratios draw classic Lissajous figures.
Export & audio
CSV columns t_s, ch1, ch2 for HIL/co-sim. WAV is a mono mix. Browser audio uses the Web Audio API (looped buffer) — watch levels.
Open the Signal Generator & Scope, set CH2 phase to 90°, and switch to X-Y view.