The plot we have been using is plotted with the array index along the horizontal axis. In other words, our data array was one-dimensional and was just an array of the measured data points.
The total time interval for the data record, T, determines the frequency spacing in the FFT plot.
For the ith point on the plot, the frequency for that point is i/T.
Now, with some data we can determine the resonant frequency.
We’re ready to compute the resonant frequency.
We will assume that the total time for the data was 1.024 seconds, and there were 1024 points in the data record, with one millisecond between points.
What is the frequency for an index, i = 16? Answer is (16/1024)/(.001) (One millisecond) SET UP PROBLEM.
So far we haven’t had any problems with this technique. Here’s a review of the technique and some questions.
Assuming that you have the impulse response, you can get a Bode’ plot that is equivalent to what you would get taking a frequency response, by FFTing the impulse response, and plotting it on log-log scales or db vs log f scales.
We’ve demonstrated the technique for a second order system with complex poles, but it seems clear – although you should check this – that we can do the same for data for other systems, e.g. systems with several real poles, or general combinations of real and complex poles and zeroes.
The one real question is “What if we don’t have the impulse response?”, or in particular, “What if we measure a step response – a widely used test signal – and all we have is a step response measurement?”.
If the input to a system is u(t), with a transform U(s), and the output of the system is y(t), with a transform Y(s), the transfer function is:
G(s) = Y(s)/U(s).
We can evaluate the transfer function by getting a plot of G(jw). That should work out to be:
G(jw) = Y(jw)/U(jw).
So, we should be able to transform y(t) and u(t) numerically, and divide them and plot the result.
That’s the theory, but it only works if both functions actually have transforms. A tempting line of reasoning is the following.
If the input to a system is a step, then the transform of the input is 1/s.
We can substitute s = jwin 1/s, and then compute the transfer function as:
G(jw) = jwY(jw).
image of freqency
When we take the fft of this curve, we would ideally expect to get the following spectrum in the frequency domain (based on fourier theory, we expect to see one peak of amplitude 1 at -4 Hz, and another peak of amplitude 1 at +4 Hz):
picture of freqency spectrum of sine wave
There is also a phase component, but we’ll discuss that in a future tutorial.
If you enter type fftshift.m at MATLAB’s command line, you’ll see the source code for MATLAB’s implementation of the function (use edit fftshift.m if you want to view it in the editor with syntax highlighting). I’m not posting the code here, as it is copyrighted. However, you can try it on your machine and re-implement the same in C. Its up to you to figure out the license terms etc, if you’re into any of that.
the sources:





