Show HN: Fourier Transform Visualized via WebGL
static.laszlokorte.de
static.laszlokorte.de
For example shifting the signal along the time axis results in a linear phase twist in the spectral domain.
In most textbooks I came across the phase and magnitute are plotted separately and even in digital 3d plots often only one domain at a time is plotted.
Inspired by graphics like this [1] my idea was to plot both time and spectral domains at once onto the sides of a rotating cuboid. So each 90deg rotation of the cuboid represents one fourier transform (... -> s(t) -> S(f) -> s(-t) -> S(-f) -> ...).
[1]: https://mri-q.com/uploads/3/4/5/7/34572113/3311485_orig.gif
The cuboid embeds a 3d plot of each domain on each of it's side in order to plot the imaginary values as well.
The slicing allows you to select up to two frequencies from the frequency domain and plot the corresponding basis function on the top side of the cuboid. The top side of the cube corresponds to the 3d coordinate system in the gif.
In hope this helps to clarify.
I ask because it's rather unusual to look at the F.T. of complex functions, since most useful F.T.s only deal with real-valued functions of time and it might be extra confusing as the F.T. is no longer symmetric as a result
It may also be nice to use different syntax, like `x(t)` and X(\omega)` since "s" can be a bit overloaded in the context of Fourier theory
For example, you can see the first definition on Wikipedia [2] starts with a function f:R->C.
Edit: Oh, by "symmetric" you meant the Fourier transform being symmetric about 0. I thought you meant the natural symmetry of the forms of f and \hat{f}. Still, it seems natural to me to treat the two functions similarly, including use of complex values. But I'm a (very) pure mathematician, at least in this area.
[1] Or whatever function you want to take the transform of, it doesn't have to be the time domain and is in fact often spatial. This is probably why OP used the phrase "signal domain".
Some comments on this awesome program:
1. A beautiful feature is that you can see the projection of the whole function into the complex plane. However, this visualization is difficult to see for both the frequency and time domains at the same time.
2. After some time playing with the curves, I'd like to see both sides on a flat surface. This would break the metaphor, but maybe consider an option for "unfolding" the cube to see all these visualizations at the sime time?
3. Could you add new functions? at least the Dirichlet and Fejer kernels, or even some fractal-like stuff (lacunary series, random phase noise, dubois raymond examples, etc).
I mean, true in a technical sense, but don't all the sample functions here have known analytical Fourier transforms?
One of the coolest parts about this (in my eyes) is seeing how a time shift causes a linear phase rotation in the frequency domain. But one has to choose the parameters very carefully to avoid stark aliasing (not in the Nyquist but just the "see individual line segments" sense). I would've at least hoped for a "sample count" or similar slider to control the sampling resolution.
It would also be cool to have functions in the shape dropdown that are not symmetrical. For example, I read the side text about "Taking the Fourier Transform twice results in the original signal flipped along the time axis." and wanted to try that - but with symmetrical functions the flipping is not evident. Sure, introducing a time shift did the trick, but it was a tiny disappointment.
Btw, contrary to other comments here, I like the cube visualizations and I think it makes some sense. I mean, it doesn't significantly advance my understanding/intuition by leveraging some geometric relation between the cube faces [1], but just having 3D plots of both time and frequency domain is novel to me.
[1] Although I will admit that this will help me in picturing the "apply four times to get back the original function" (does this have a name? Double-involution?).
Yes but currently I make not use of it but simply apply the DFT on the samples of the function. Making use of the analytical versions would result in smoother results but I would like to allow for custom signal functions in the future so I would like to keep the simple approach of just doing the DFT.
> It would also be cool to have functions in the shape dropdown that are not symmetrical. Nice idea but what interesting functins would be there that are not achieved by using the time shift?
> Sure, introducing a time shift did the trick, but it was a tiny disappointment. I agree
Well, a sawtooth for example?
PS: You need two line breaks to have your replies in a separate line.
I understand that you wanted to visualise that spectral and signal domains are orthogonal, but I don't think having them on different sides of the cube conveys any information.
So for example if I turn to look at both the green face and the red face, they both have an "lm" arrow, but their arrows are pointing in different directions. Doesn't that just mean that the two diagrams don't belong on two adjacent faces of a cube at 90 degrees apart?
However, the Im parts are just bolted on orthogonally to the Re parts and orthogonally to the magnitude. The reason the Im part of the time series shares an axis with frequency is just because the author ran out of dimensions.