
The FFT produces 512 harmonics (N/2) from this set of samples. The spacing between harmonics is 1 Hz, equal to the frequency of the first harmonic (f1 = 1/T). The second figure plots magnitudes of the first 100 harmonics. Note that the term harmonic can be confusing because it id derived from the window length T and may have no obvious relationship to the signal.

The spectrum indicates that the original signal is composed of 2 basic components but leakage makes it difficult to determine the magnitudes. The original signal was actually composed of 2 tones. One is an 11.6 Hz tone with an amplitude of 75 while the second is 55.4 Hz with an amplitude of 90.
The spectrum shows one peak at 12 Hz with a magnitude of 55.1 and another at 55 Hz with a magnitude of 68.2. The relative magnitude of the 2 components is close but the absolute magnitudes are badly distorted.
Window Example - Triangle and Hamming
The next figure shows the waveform from the previous example modified by a Triangle Window. The original waveform was sampled in exactly the same way as before but the sampled points were scaled by the triangular window. Note how the early and the late sample points are now attenuated.

The next plot shows the first 100 harmonics when this modified set of samples is used.

The peaks are at the same frequency but there is clearly less spreading (leakage). The magnitudes are also more accurate (65.7 and 78.8) but still incorrect.
Another popular window is the Hamming Window based on a cosine function. It is also designed to peak in the center of the samples and taper to zero at the ends. Using the Hamming Window on the same set of samples produces the following spectrum. The peaks are located at the same points with amplitudes of 65.7 and 79.1.

Note: The magnitudes have been corrected for a type of amplitude error created by non-rectangular windows. The factor is 0.5 for the Triangle and 0.54 for the Hamming. This is a technical correction based on lobe height.
Notes on Selecting a Window
1. If the input signal is periodic and a multiple of the sampling window, then use a Rectangular window.
2. If the input is a short pulse or burst that starts and ends at the same amplitude, then use a Rectangular window (as long as the sampling window includes the entire transient).
3. If the input is a sections of a continuous waveform that is not periodic then use the Hamming or Triangular windows.
Re-Sampling
As illustrated in the previous examples, the use of weighted windowing can improve the quality of the spectrum when frequency components are not integer multiples of the sampling window. Unfortunately, the examples also indicate that even with a weighted window, there is still some distortion.
In situations where major frequency components are multiples of one another, the best approach is to adjust the sampling process so that a full period of the input signal lines up with the sampling window. If this can be done, the best window is Rectangular. This situation is found in applications like power line monitoring where there is a strong primary frequency driving the signal.
The cleanest approach is to adjust the sample rate until N points are obtained in exactly one period of the input signal. This may not be practical when using the FFT because N must be a power of 2. The required sample rate may not be available or the data may have been collected previously and cannot be duplicated.
The solution to both problems is to re-sample a set of data, interpolating where required to produce the desired set of samples.
Decibels
It is common to present the amplitude of the frequency spectrum in decibels (dB). A decibel (1/10 Bel) is a unit originally used to measure the intensity of a sound with reference to a standard sound. In general, it can be used to indicate the intensity or power of any signal with respect to a reference. The user of a logarithmic scale permits a large range of amplitudes to be presented on a single plot.
As it applies to power, the dB is defined as: dB = 10log(Power/Reference Power)
Note that a negative value indicates power less than the reference. The reference varies with the application and this fact can cause some confusion. A letter is sometimes added to indicate the use of a standard reference. For example, a dBm measures signal power with respect to 1 milliwatt. Assuming power is measured in watts, the following equation applies: dBm =10Log(Mag/.001)
It has become common practice to treat the squared value of certain signals as power. In the case of a voltage waveform and a fixed load, this is valid because power is actually V*V/R. Following this logic, the units of dBm are sometime used when only a voltage signal is available by assuming a standard load of 50 ohms. A sinusoidal voltage with a magnitude of 0.316 V is shown as 0 dBm (1 milliwatt).
The situation gets more confusing because most electrical engineers use the term dB to indicate signal amplitude (not signal power) with respect to a reference. This can be linked mathematically to the standard definition as long as a constant electrical load (R) is assumed because: