Inverse Fourier transform for bandstop filtering
A free video tutorial from Mike X Cohen
Neuroscientist, writer, professor
4.5 instructor rating • 20 courses • 102,721 students
See an application of the inverse Fourier transform in signal processing.
Learn more from the full courseMaster the Fourier transform and its applications
Learn the Fourier transform in MATLAB and Python, and its applications in digital signal processing and image processing
06:42:00 of on-demand video • Updated January 2021
- Learn about one of the single most important equations in all of modern technology and therefore human civilization.
- The fundamental concepts underlying the Fourier transform
- Sine waves, complex numbers, dot products, sampling theorem, aliasing, and more!
- Interpret the results of the Fourier transform
- Apply the Fourier transform in MATLAB and Python!
- Use the fast Fourier transform in signal processing applications
- Improve your MATLAB and/or Python programming skills
- Know the limitations of interpreting the Fourier transform.
English [Auto] At the end of the previous video, I mentioned that one of the important uses of the inverse Fourier transform is in the context of data analysis and signal processing, and the idea is to implement signal processing techniques in the frequency domain and then use the inverse for a transform to get back to the time domain. So I also mentioned that I'm going to discuss these topics in more detail in a later section of this course, as well as in my signal processing course. But I thought it would be interesting to already introduce the idea here. So here is the idea. You compute the Fourier transform of a signal, change the amplitudes or the phase values in the frequency domain, and then compute the inverse Fourier transform to get back to the time domain. This procedure is useful only when there are clearly spectral separable components in the signal. Let me show you an example of using the inverse Fourier transform for Benschop filtering in Matlab. So here I create a signal, it's just the sum of two sound waves at four hertz and at 10 hertz. Here I compete, the foyer transform, nothing new, nothing new. And then here I'm going to compete the inverse Fourier transform and then make some plot. So first, let me show you what the original plot looks like. So I'm going to run this code. And I don't care about this stuff, I just want to show you what the original signal looks like. And I'll also show you the. Original amplitude spectrum. All right, so here we have our signal. It's a combination of a what is it, a four hertz and a 10 hertz sine wave. So it's two sine wave, some on top of each other. And that you see perfectly accurately reconstructed in the. Amplitude spectrum here in this plot. Now, what I want to do is eliminate the 10 hertz frequency component from this spectrum so that we get a pure sine wave at four hertz. That's going to be the goal. And the mechanism, the way that I'm going to do that is by taking the Fourier coefficients from the forward for you transform. Then I'm going to identify the frequency index corresponding to 10 hertz. That's going to be this component here. And then I'm going to set that Fourier coefficient to be zero. So now that I've modulated the four year coefficients, then I'm going to do a reconstruction using the inverse for a transform and now I'm not using the original Fourier coefficients, but the modulated four year coefficients with the coefficient corresponding to the tenants component set to zero. And then we're going to plot that and see what that looks like. All right. So now I'm going to run this entire cell and we can take a look. So here's the original signal. This is the amplitude spectrum of the original signal, and now here is the band stopped filtered signal. So you might be a little bit confused and perhaps a little bit disappointed because I said that our goal was to reconstruct exactly the four hertz component without the 10 Hertz component. But when you look at this, this is clearly not a pure sine wave. In fact, it looks an awful lot like this original signal. But these faster sound waves are. Dampened, so they're a little bit smaller in amplitude compared to what they are here. I encourage you to pause the video and see if you can figure out what went wrong here, what's wrong in the code and why we still have a tennants component here. So it turns out that what went wrong here is that I didn't account for the fact that the amplitude of this. 10 hertz component is split between the positive frequencies and the negative frequencies. So, in fact, what I've done here is zero out the positive frequency, but I did not zero out the negative frequency, the corresponding negative frequency for 10 hertz. So that means that I only actually attenuated the Tennet signal. I got rid of half of its amplitude. Half of its amplitude was still in the negative frequency. So let me do that. Let me get rid of the corresponding negative frequency. So that's going to be f collapse modulated. And now I want the. So I want to go from the end to the negative frequency is going to be from the end minus Frech idex. And then we have to add this plus two here. So this plus two is actually just a matlab indexing. Normally it would be a plus one for typical indexing. However, you also have to account for the DC component. For the DC component is the first element in the positive frequencies. But remember that the negative frequencies don't have a zero hertz component, so therefore we have to add an additional offset to the negative frequencies going backwards to account for this DC component here. I realize that's a little bit confusing, but this is just something about programming and indexing. This is not really about the 48 transform. The important thing about the four year transform is that I'm also setting to zero the four year coefficient corresponding to minus 10 hertz. OK, and now I'm going to run this whole cell again. And now you see we don't see any 10 hertz component in the reconstructed signal. There's only a four Hertz component. Now, from this example, you can see why this procedure is appropriate only for signals that have clearly speciale separable components if these two signals and we see these two components of the signal. Overlapped in the frequency domain, then simply removing some frequencies is not going to isolate one part of the signal. Now, one important word of warning this procedure where I just zeroed out one Fourier coefficient. Can introduce artifacts in the time domain signal, so typically you would not want to just set some Fourier coefficients exactly to zero. Typically, you would want to have some kind of gentle slope instead of a hard edge. I'll show why that's the case in the section about the effects of non stationary disease and in my course on signal processing, I talk a lot more about optimal design and appropriate design of low pass filters and high pass filters, benchtop filters and then pass filters. In this case, this very hard edge filter happens to work really well because the signal contains only pure sine waves. In this video, I showed you an application of using the inverse Fourier transform to suppress one spectral feature of a signal while leaving another spectral feature untouched. This shows the usefulness of the inverse Fourier transform for signal processing applications.