Graphing: Bubbles: Coefficients: Residual Error:
This application generates a random signal as a sequence of segments of sinusoids, inflections, and jump discontinuities, and then generates a Fourier series estimation of the signal. The simulation generates an approximation of the signal, using a Fourier series as a sum of sinusoids. The line graph at the top left of the canvas reflects the total error for the current estimate.
The Fourier series estimate is a sum of sinusoids of different frequencies and amplitudes. The estimation begins with a first sinusoid (k = 0) with frequency 0 (i.e., a horizontal line), and an amplitude (i.e., y-offset) is selected to fit the signal. The second sinusoid (k = 1) has a frequency of 2 pi / canvas width (i.e., a single sine wave spanning the width of the canvas) and, again, an amplitude that fits the sinusoid to the signal. The second estimate (n = 1) is the sum of these first two sinusoids. The third sinusoid (k = 2) has a frequency of 4 pi / canvas width (i.e., two sinusoidal cycles over the width of the canvas) and an amplitude that fit for the signal, and the third estimate (n = 2) is the sum of the first three sinusoids, etc.
It is surprising how quickly the estimation fits the complicated shape of the random signal. Moreover, even as the estimate generally fits the shape of the curve, the continued application of the Fourier series refines the estimate for the fine details of the signal, such as the inflection points and jump discontinuities. This accuracy is even more surprising based on the simplicity of the algorithm: the estimation is achieved through two simple integrals (one to calculate the coefficient for the latest iteration, and one to add the samples of the sinusoid with the latest coefficient to the previous estimate).
The rate of error reduction is also interesting for several reasons. First, the error falls quickly for the first several estimates; but continuing to add higher-frequency wavelengths results in periods of plateau with almost no error reduction, followed by occasionally large reductions in the worldor rate. This behavior is caused by the fact that once the estimate generally fits the signal, further improvement to fit the curve to a fine detail requires a precise wavelength of the sinusoid. The estimates between precise wavelengths do not particularly fit any remaining feature of the signal, and therefore do not significantly contribute to the improvement of the estimate. Second, the reduction rate of the error is inversely proportional with the volatility of the graph (i.e., smaller step lengths and higher resolution). Finally, while the error appears to reach e = 0 (and the simulation ends there), this is a function of sampling error rather than an exact convergence of the series. While the error does converge to zero, it does not actually reach zero within the range of the Fourier series presented in this simulation.