Desmos Graphing & Signal Visualization Demonstration

This note demonstrates the full capabilities of the obsidian-desmos plugin. It is structured around the mathematical and signal concepts relevant to the 2-1 Fourier Series and Systems syllabus, illustrating how to plot basic waveforms, show mathematical symmetries, construct Fourier series approximations, and represent piecewise functions.


1. Basic Trigonometric Waveforms

To plot basic continuous waveforms, we can use simple LaTeX functions. Here, we plot a fundamental sine wave along with its second harmonic. We restrict the viewport to focus on two periods.

left = -2\pi; right = 2\pi;
top = 2; bottom = -2;
grid = true
---
y = \sin(x) | RED | SOLID
y = \sin(2x) | BLUE | DASHED

2. Symmetry Analysis (Even vs. Odd Functions)

Symmetry simplifies Fourier coefficient calculations.

  • Even functions () are symmetric about the y-axis.
  • Odd functions () are symmetric about the origin.

The following graph plots a quadratic function (Even, green) and a cubic function (Odd, orange). We also place a point to label the origin symmetry transition.

left = -4; right = 4;
top = 8; bottom = -8;
---
y = 0.5x^2 | GREEN | SOLID
y = 0.2x^3 | ORANGE | SOLID
(0,0) | open | BLACK | label:Origin Symmetry Point

3. Piecewise Functions and Signal Restrictions

Piecewise signals are very common in communications. We can use domain restrictions to plot a piecewise function such as:

We also use open and closed markers to indicate interval endpoints at .

left = -4; right = 4;
top = 2; bottom = -2;
grid = true
---
y = -1 | -\pi < x < 0 | BLUE | SOLID
y = 1 | 0 \le x < \pi | RED | SOLID
(0,-1) | open | BLUE
(0,1) | POINT | RED | label:Discontinuity

4. Fourier Series Square Wave Approximation

A square wave can be synthesized using a sum of odd harmonics:

In this graph, we define a hidden base frequency and intermediate harmonics, then plot the resulting 1st, 3rd, and 5th harmonic partial sum approximations to visualize convergence.

left = -10; right = 10;
top = 2; bottom = -2;
---
w = 1 | hidden
f_1(x) = \frac{4}{\pi} \sin(w \cdot x) | hidden
f_3(x) = f_1(x) + \frac{4}{3\pi} \sin(3 \cdot w \cdot x) | hidden
f_5(x) = f_3(x) + \frac{4}{5\pi} \sin(5 \cdot w \cdot x) | hidden
 
f_1(x) | DOTTED | CYAN
f_3(x) | DASHED | MAGENTA
f_5(x) | SOLID | PURPLE

5. Gibbs Phenomenon Peak Detection

When approximating a signal with jump discontinuities, the Fourier series exhibits overshoot (about ) near the discontinuities. Here, we plot a high-order Fourier sum and label the overshoot peak.

left = -1; right = 4;
top = 1.5; bottom = -1.5;
---
g(x) = \frac{4}{\pi} ( \sin(x) + \frac{\sin(3x)}{3} + \frac{\sin(5x)}{5} + \frac{\sin(7x)}{7} + \frac{\sin(9x)}{9} ) | hidden
 
g(x) | BLUE | SOLID
(0.28, 1.18) | cross | RED | label:Gibbs Overshoot (~18%)