Thomas Piacentini
← Workshop

06 / 15 · 60–90 min

Listen to frequencies.

What does a filter preserve and what does it remove?

Choose a laboratory
Check my intuition

01 · Predict

Before changing the settings.

A 6 Hz sinusoid is sampled at 8 Hz. Which positive frequency between 0 and 4 Hz has the same samples up to sign or phase?

A hint

Compare 6 Hz with 8 − 6 Hz.

02 · Experiment and compare

Put the model to the test.

Keep the useful frequency at 5 Hz. Set the cutoff below 5, between 5 and 17, and above 17 Hz. Then try interference at 59 Hz: its alias overlaps the useful signal.

-1.60-0.80.30.10.50.90.81.71Amplitude by frequency (Hz)01632
Top: useful signal, measurement and reconstruction. Bottom: frequency amplitudes; solid bars are retained.

64 samples over one second. Dashed: useful signal; thin: measurement; thick: low-pass output.

Raw RMSE
0.50
Filtered RMSE
0.07
Aliased frequency
17.00 Hz
Compare A and B →

Read values as a table
t (s)Useful signalMeasurementFiltered
0.000.00-0.10-0.10
0.020.471.140.33
0.030.830.510.70
0.051.000.210.93
0.060.921.140.92
0.080.631.370.65
0.090.20-0.220.16
0.11-0.29-1.01-0.40
0.13-0.71-0.28-0.87
0.14-0.96-0.84-1.10
0.16-0.98-1.51-1.03
0.17-0.77-1.00-0.72
0.19-0.380.41-0.25
0.200.100.340.24
0.220.56-0.020.66
0.230.880.920.94
0.251.001.741.03
0.270.880.670.90
0.280.560.110.56
0.300.100.210.09
0.31-0.380.16-0.41
0.33-0.77-1.16-0.81
0.34-0.98-1.51-1.01
0.36-0.96-0.48-0.97
0.38-0.71-0.25-0.72
0.39-0.29-0.95-0.32
0.410.20-0.220.15
0.420.631.280.60
0.440.921.160.93
0.451.000.351.05
0.470.830.900.91
0.480.471.030.52
0.500.000.08-8.65E-3
0.52-0.47-1.21-0.52
0.53-0.83-0.70-0.86
0.55-1.00-0.29-0.95
0.56-0.92-1.14-0.81
0.58-0.63-1.05-0.50
0.59-0.200.29-0.12
0.610.290.720.26
0.630.710.090.60
0.640.960.490.83
0.660.981.410.89
0.670.771.080.74
0.690.38-0.260.39
0.70-0.10-0.43-0.10
0.72-0.560.26-0.57
0.73-0.88-0.85-0.91
0.75-1.00-1.64-1.02
0.77-0.88-1.03-0.89
0.78-0.560.17-0.57
0.80-0.10-0.29-0.15
0.810.38-0.290.30
0.830.770.960.68
0.840.981.460.93
0.860.960.550.97
0.880.710.290.76
0.890.290.870.35
0.91-0.200.29-0.16
0.92-0.63-1.29-0.62
0.94-0.92-1.22-0.92
0.95-1.00-0.26-0.98
0.97-0.83-0.68-0.83
0.98-0.47-1.27-0.51
Understand the calculations

03 · Connect the diagram to calculations

The numbers behind motion.

We measure 64 points over one second at 64 Hz. The discrete transform decomposes samples into complex components. The filter keeps frequencies up to the cutoff and their conjugates, then applies the inverse transform. It cannot distinguish causes with the same sampled frequencies. An ideal filter can also create ringing on other signals.

X[k] = Σₙ x[n] exp(−i 2πkn/N)
x[n] = (1/N) Σₖ X[k] exp(i 2πkn/N)
N = 64 ; f_sampling = 64 Hz ; f_Nyquist = 32 Hz
A few lines to reconstruct
keep = min(k, N-k) <= cutoff
filtered_spectrum[k] = spectrum[k] if keep else 0j

The notebook provides one function per laboratory, hand-calculated examples and tests. Exercises isolate components; these pages run the complete simulations.

Keep an observation

04 · Record

What changed?

Compare two settings. Record the effect, your explanation and a case where the model might fail. Saving keeps the current settings and seed, not a certification of competence.

Open my notebook →

atomsh / lab