To plot the Fourier Transform of a sine wave using Matlab, you can follow these steps:
main.m194 chars5 lines
fft
function to compute the discrete Fourier transform of the signal.main.m66 chars5 lines
The fft
function returns a complex spectrum, so we calculate the magnitude of the spectrum using the abs
function. The frequency axis is obtained by scaling the index of the FFT to the range of frequencies up to the Nyquist frequency Fs/2
.
plot
function.main.m63 chars4 lines
This will give you a plot of the magnitude of the Fourier Transform of the sine wave, with a peak at the frequency of the sine wave (200Hz in this case).
Here's the complete code:
main.m324 chars14 lines
gistlibby LogSnag