Understanding Fourier, signals and spectrum analyzer

I'm having a hard time grasping the relation of Fourier analysis to the nature of signals and spectrum analyzers. From what I understand, Fourier analysis gives us a mathematical representation of a signal, but we don't need a infinite number of harmonics to make a square wave, for example. So if I put a perfect square wave signal into a spectrum analyzer, using simple 5v on/off switch, it will "see" all diferent harmonics or not? Maybe my question is: A specturm analyzer will have an algorithm to do a Fourier analysis of a signal or will actually perceive different frequencies? Sorry if my question is naive or hard to understand, im still a student.

• We do need a infinite number of harmonics to make a square. It's just that in reality, we say that a finite amount of harmonics is good enough. When you really zoom in on the square tho, you notice it's not in fact an ideal square - it will exhibit ringing or undershoot and ripples. – Joren Vaes Aug 30 '17 at 15:11
• Yes in theory all the frequency components need to be present in the ideal square wave. But in the real world everything has limitations. Like a bandwidth limitation on a spectrum Analyzer. In practice you also don't need to see all harmonics and leaving them out will still be good enough to see a square wave. For example a 1 MHz square wave will still look a lot like a square wave if you leave out everything above 100 MHz. – Bimpelrekkie Aug 30 '17 at 15:13
• Depending on the type/model of spectrum analyzer (SA) it will do an FFT or not. Older SA are often completely analog, so no FFT. These work like a complex radio receiver with narrow filters and peak-detectors. Many oscilloscopes have an FFT function so they can show a spectral plot. – Bimpelrekkie Aug 30 '17 at 15:16
• This is somewhat related to my question in physics SE. Yakk's answer in particular might be answering your question. – Schizomorph Aug 31 '17 at 10:00

Others have posted some very nice visual explanatory tools, yet to me, they seem to be a step or two down the road from the absolute basics. Let me offer my own super-basic explanation:

First, try to multiply two sinewaves, over some period of time, say two or three periods of your slower sinewave. Take a piece of paper and a pencil if you will, but a couple discrete-time samples calculated in Excel can also produce a valid chart. Start by simple examples, such as: two sine waves of unity amplitude, same frequency, same phase, centered around 0 amplitude (= no DC offset). You need to multiply the instantaneous scalar value at every point in time to produce the resulting third wave (= multiplication product).

Unfortunately I don't have a visual software tool to facilitate this super-simple mental experiment... A quick search through Google Images has revealed two static charts here.

Further points to consider:

If you multiply two negative numbers (scalars), you get a positive number (scalar). For the result to be negative, you need to multiply a positive and a negative number. Therefore, if you multiply two identical sine waves, the product wave lives in positive numbers only, plus the zero. (And, the product happens to be a pure sine wave of double frequency and DC-shifted, but that doesn't seem to be of much concern here, don't let it mess up your mind.)

To produce some negative values in your "multiplication product" wave, you need a phase shift, or waves of two different frequencies. Watch the individual quadrants expand into the negative values.

Try multiplying two sinewaves with only somewhat different frequencies, say 20% difference, over maybe 10 periods of the slower signal. The link points to an article on superhets, but the sinewave multiplication applies equally, and the waveform plot is very nice (only we could use a zero axis for the "product" waveform in our topic).

Next, guess what happens if you integrate the product wave in time. This is a key operation: your spectral line (the output "amplitude" for a single frequency) is your multiplication product wave, integrated over a given time window.

Note that if you multiply your "input signal" by a sinewave (your "probe"), the product wave (and its integral) will reflect the phase of the probe relative to the input. E.g., for two pure identical sinewaves, that are 90 degrees out of phase, the multiplication product wave will be centered around zero, and its integral will therefore be 0. As if the input wave "was not there"!

To capture an input sinewave regardless of its phase, you need to perform the "waveform multiplication" operation twice for each frequency of interest (probe), using sine and cosine waves for a "probe". Note that sine and cosine are just identical waves, only 90 degrees phase-shifted. Thus, when the sine multiple produces a zero "integrated amplitude", the cosine multiple produces your desired full value. For phases other than 90 degrees, just consider the two output values as a complex number, which you can use as such, or you can calculate its Pythagorean absolute value if you're not interested in the phase.

The Fourier transform means, that you do this "wave multiplication followed by integration" for a certain range of frequencies. As for the range of frequencies considered, it can be discrete or continuous, bounded or unlimited... In theory, an arbitrary continuous signal over a bounded time period produces a continuous spectral image over an infinite range of frequencies. In practice, FT is calculated over a bounded time period of discrete time domain samples, to produce a bounded range of discrete frequency samples. You only have a finite resolution in time and amplitude, and a finite amount of number-crunching horsepower.

An arbitrary input signal (including a square wave) simply "rings" different "sinusoidal probes" with a different phase angle and intensity. And, a square wave rings a series of harmonic sinewaves. A pefect sawtooth does something similar. Essentially any sharp corners in the signal produce a series of harmonics, because you need a series of sine waves of different frequencies to sum up to a half-decent sharp corner in the time domain.

As a homework, but you may have been wondering about this already: think about the effect of window size (temporal, in the input signal) on the result, considering a pure sinewave for input and a pure sinewave for output. And, what happens if the window size gradually decreases relative to the period of your "probe" frequency and of your input waveform.

Spectrum analyzers usually work by doing a sweep over the frequency range. At any one time, it is looking at only a narrow frequency range. It records the amplitude of what it received over that range, then moves on to the next range.

Actually these devices are usually analog, so the sweep is continuous, and so is the result. As the detection frequency is swept, the received amplitude is measured. This results in a graph of amplitude as a function of frequency.

If you put a perfect square wave into a perfect frequency analyzer, it will show blips at all the odd harmonics. These blips decrease in amplitude with increasing frequency.

A Fourier transform is a way of doing mathematically what a spectrum analyzer does by measurement. The restriction is that the input signal must be periodic. The result is a equation that yields amplitude as a function of frequency. Actually there are two equations because a Fourier transform also gives you the phase at each frequency. This can be expressed as either the sin and cos components, amplitude and phase shift, or any other representation that preserves both degrees of freedom.

A discrete Fourier transform works on individual samples, like you would get by repeatedly measuring a signal with a A/D. The result is the amplitude and phase at a set of discrete frequencies. There is a clever computational trick that is now routinely used to reduce the computation cycles to perform a discrete Fourier transform. This is called a FFT, which stands for Fast Fourier Transform. The first F refers to the particular method of achieving the result, and FT refers to the result. A "slow" FT would give the same result. The name has stuck so that "FFT" is used even when the actual method of computing the FT is irrelevant to the discussion.

• Thank you. The waves that it detects are sinusoidals, of different amplitudes in different frequencies, but how this happens if the input is constant over half the period? – João Pedro Aug 30 '17 at 15:55
• en.wikipedia.org/wiki/File:Periodic_identity_function.gif I hope this gif helps you better understand your question. – Mayank Aug 31 '17 at 10:31
• @JoãoPedro what Olin is trying to tell here is the general case. The amplitude and phase of sine waves will depend on the original signal under test. – Mayank Aug 31 '17 at 10:57

I think this interactive java web application will answer alot of your questions.

Choose Mag/phase view button then Log display for best results and slide n (terms) harmonics to see result change in recursive wave in red with infinite terms in white.

You can even listen to an audio tone of the wave as your ears and brain do Fourier analysis automatically.

When you point to any harmonic, it will display the actual amplitude in the repeating pattern. Choose any standard waveform and limit n , or draw your own arbitrary wave and compare.

Remember these laws of Fourier spectrum;

• impulses and steps contain continuous spectrum, but this analyzer repeats the pattern of the wave, so discrete harmonics depend on shape.
• square waves have no even harmonics, but if slightly asymmetric, these rise rapidly to even amplitudes for a narrow repetitive spike.
• phase shift of harmonics reflects the filter effect of integration of a square into a triangle wave so amplitude and phase of fourier shows this when Mag/Phase display with Log.(arithm)
• the 1st spike shows the DC average level , next its fundamental f • For the advanced Biomedical Engineer, try to draw a heart beat and analyze the results then change phase spikes use a tap and drag at an angle for fine tuning to simulate cardiac strain. Clear button means your flatlined. – Sunnyskyguy EE75 Aug 30 '17 at 17:14
• So a square wave, for example, also oscillates a little bit in the upper and lower part of the wave? Is it possible to have something like 5v up / 5v down, without oscillation? In multisim I see for example that it changes between 5.001 and 4.999. I think my question is to whether all signals will obligatory be made of sinusoidals of different frequencies. – João Pedro Aug 30 '17 at 22:56
• it all depends on n as I said, this simulates only a couple decades<3.. The ratios are computed. Slide n. try again – Sunnyskyguy EE75 Aug 30 '17 at 23:09

I think this video will help you understand how waves add together and how we can analyze them to their frequency components. It has certainly helped me because I am a visual type and the visualizations in this video make it very intuitive.

This is a subject that's been bothering me for years and there are many levels of understanding Fourier. On a basic level, it is a way to transform a signal (see it in a different domain) from the time domain to the frequency domain and back (using the inverse Fourier transform). This reveals the 'fact' that any complex waveform is made up of a number of sine waves (single frequencies).

I put the word fact in quotes because as you can see in the answers to the question I made on the physics SE, it is debatable to point that becomes philosophical whether sine waves are real or just a mathematical construct that helps us analyze natural processes. It all boils down to what reality is.

I think the simplest way to describe the Fourier transform in simple words is using part of Yakk's answer to my question.

You can step back and look at the fourier transform. You start with some wave. You multiply it against the original signal (using convolution), and from the result work out how much they overlap and what is the best scale of the wave to approximate the original signal.

Then you subtract that scaled wave from the original signal. This "removes the frequency component" from the original signal (in that if you convolved it with the wave again, you'd get zero).

We then repeat this with different frequencies, each time "removing a frequency component". So long as the frequency components we remove are orthogonal to each other (a generalization of being "at right angles"), removing new frequency components doesn't "bring back" the old ones.

As it happens, "removing the frequency component" corresponds to an operation.

If you set of a resonance cavity of length L down which pressure waves travel at speed S, and have some repeating set of pressure waves, the cavity will amplify the part of the pressure wave of frequency L/S that roughly corresponds to a the convolution of the sin wave with the amplitude of the pressure wave over time.

That seems pretty academic, but have you ever looked at your ears?

They are resonance cavities. Pressure waves go in, and bounce back and forth.

Along the side of it, there are hairs that pick up changes in pressure. Waves of various frequencies are amplified and damped by the resonance chamber and excite and ignore a predictable set of hairs.

In short, our ears split pressure waves into something a lot like what fourier analysis does. We have physical fourier transformers on our head attached to our brain.

So when we do a fourier analysis and say that there is a strong signal at 550 Hz, this corresponds to what our ears hear because our ears are doing something that the math approximates and mapping the pressure waves into a spectrum of frequencies for us to hear.

A spectrum analyzer does indeed perform a fast Fourier transform (FFT) which is an optimized (faster) algorithm. It has a certain resolution in the frequency domain, so it doesn't check for every frequency. It also cannot detect phase. There are special algorithms for that which (I think) are used in astronomy and submarine detection.

I understand Fourier series and transform is somewhat tough to understand when you start with it but once you understand it you will know that its the most beautiful thing that mathematics has given.

Whenever I can't understand some concept or the purpose of same I try to understand the history or motive behind the same and that pretty much explains most of the things.

Now the problem in physics is there are a lot of equations describing something or some shape which can have varying meaning depending upon the system we are trying to study. Now the problem arises that for every system we have a different set of behavior and equation and every time it looks like some new problem which needs new methods/ approach and analysis. Now don't we like it to keep it simple and have only one tool that can solve all your problems (or at least most of it)

That's where Fourier comes to rescue. Now the basic principle here is that i only need to know properties of sine and cosine and i will try to decompose any (or most) of the signal into a combination of sine and cosine wave. Now the wave may not look exactly the same as the original wave but still, it's very close to it and does the job. The above picture is not a perfect square wave but its very close to it.

Now the oscillations that you see at the end are also named as "Gibbs phenomenon".

whether all signals will obligatory be made of sinusoidal of different frequencies

No, it's not obligatory of any signal to be made of sinusoidal, but as I explained before its a mathematical tool or approach to solving complex signals.

• It's a mathematical principle that any repeating waveform can be built up out of a sufficiently large number of sine waves. That's not just an approximation, a good mathematician should be able to prove it. (Note that I'm only an adquate mathematician, so I accept what those who know more than me say.) A waveform that has a duty cycle that's not exactly 50/50 will have even harmonics, because it's not a perfect square wave. – Simon B Jan 12 '18 at 10:31

The Fourier Transform can only map input energy into sinusoids, because the only basis function allowed in Fourier Transform is a sin/cosine wave. The math operation performed in Fourier Transform is "correlation", and the peak responses are where the allowed basis functions are maximally correlated. to the input waveform.

Now ---- can a 100MHz clock cause a 100MHz LC resonator to ring? yes

Can a 100MHz clock cause a 200MHz LC resonator to ring? depends on duty cycle

Can a 100MHz clock cause a 300MHz LC resonator to ring? yes

Can a 100MHz clock cause a 313MHz LC resonator to ring? yes; depends upon "Q"

Summary of this --- harmonics do not exist.

What we consider to be indication of a harmonic is merely a local peak in the correlation. A 100MHz clock will cause a 300MHz LC resonator to ring, and also cause a 313MHz resonator to ring. Depending on "Q", where "Q" merely indicated the time-duration of the signals fed into the correlator (and the Low Pass Filter imposed on correlator output).

Here is a 20MHz rectangular wave, 45% duty cycle, driving a 50MHz LC resonator with Q of 100. What is doing on? And here are the input/output waveforms along with input/system/output spectra (magnitude only; I disabled the phase plots) • Do you understand what is being demonstrated here? – analogsystemsrf Jan 13 '18 at 3:47