Now, you can draw your own function, and the generator will create a Fourier series to approximate it. It's a fun and interactive way to understand how Fourier series can approximate any periodic function.
Create your own Fourier series by drawing on the canvas!
If you've been exploring this tool, you might have noticed something strange. Once the 'Number of Harmonics' (which determines the number of terms in our Fourier series approximation) surpasses 150, the approximation starts looking worse, not better. You might think, "The more terms we use, the closer the approximation should be, right?" Here's why that isn't always the case.
When we're turning a complex wave (like a picture or a song) into a bunch of numbers, we have to decide how many numbers to use. This process is like taking a picture of a scene. The more photos we take, the clearer the final image will be. The 'rate' at which we take these photos is like our sampling rate.
But, there's a catch. If we try to represent something that's changing very rapidly, we need to take pictures very quickly to capture those changes. If we don't, weird effects start to happen. Imagine trying to take a photo of a spinning fan with a slow camera - the fan might appear to be still or even spinning backwards! This is called 'aliasing.'
In our case, we're trying to draw a complicated shape with a series of simple waves (sine and cosine waves). We add these waves together to create our shape. The more waves we use (the higher the 'n' value), the closer our approximation will be. But if we try to use more waves than half the total number of data points we have (this is known as the Nyquist frequency), we run into the aliasing problem.
This is why, when 'n' reaches half the total number of points, our approximation actually starts to look worse. We're trying to represent changes that are too rapid for the amount of data we have. To solve this, we would need more data points, like taking more photos to accurately capture a rapidly spinning fan.