wingsofaero.inwingsofaero.in/.../uploads/2018/12/spectrum-of-the-sampled-signal.d… · web view2....

33
2. The Concept of a Spectrum Consider the general expression for a sinusoid, using the cosine function. The function has a frequency f (in Hertz) that is equal to the inverse of the time it takes to complete one period of oscillation. At a given frequency it takes two pieces of information to specify such a wave; its amplitude A and its phase (in radians). Note that the amplitude is half the peak to peak fluctuation and, if you work it out, the r.m.s. is 1/√2 (= 0.7071) of the amplitude. Note that the phase is an angle, and that negative phase corresponds to positive time delay of the wave. When we ask the question "what frequencies are in the signal?" what we really mean is "If we fit the shape of the signal to a sum of sinusoids of different frequencies, what is the distribution of amplitudes and phases as a function of the frequency?" This question has a useful answer because of Fourier's theorem which states that any signal of zero mean value can be represented as a unique sum of sinusoids. When we decompose our signal into its component sinusoids, the resulting plot representing amplitude or phase as a function of frequency is referred to as a spectrum. There are three types of spectra we need to be concerned with at this stage: 1. The amplitude spectrum - a plot of the sine wave amplitude vs. frequency. Note that when engineers refer to the amplitude spectrum they may either mean the amplitude

Upload: dinhtu

Post on 23-Apr-2019

225 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

2. The Concept of a Spectrum

Consider the general expression for a sinusoid, using the cosine function.

The function has a frequency f  (in Hertz) that is equal to the inverse of the time it takes to complete one period of oscillation. At a given frequency it takes two pieces of information to specify such a wave; its amplitude A and its phase (in radians). Note that the amplitude is half the peak to peak fluctuation and, if you work it out, the r.m.s. is 1/√2 (= 0.7071) of the amplitude. Note that the phase is an angle, and that negative phase corresponds to positive time delay of the wave.

When we ask the question "what frequencies are in the signal?" what we really mean is "If we fit the shape of the signal to a sum of sinusoids of different frequencies, what is the distribution of amplitudes and phases as a function of the frequency?" This question has a useful answer because of Fourier's theorem which states that any signal of zero mean value can be represented as a unique sum of sinusoids.

When we decompose our signal into its component sinusoids, the resulting plot representing amplitude or phase as a function of frequency is referred to as a spectrum. There are three types of spectra we need to be concerned with at this stage:

1. The amplitude spectrum - a plot of the sine wave amplitude vs. frequency. Note that when engineers refer to the amplitude spectrum they may either mean the amplitude itself A or the r.m.s. amplitude (= 0.7071A). You often have to look carefully (or ask) as to which is being used.

2. The phase spectrum - may be plotted in radians or degrees.3. The power spectrum - plot of Amplitude2/2 vs. Frequency.  This is called the power

spectrum because the square of the variable represented by the amplitude (e.g. velocity, voltage, displacement) is often proportional to a rate of work being done. However, the term power spectrum always means Amplitude2/2 vs. Frequency even when this isn't the case.

3. The Spectrum of a Sampled Signal

Page 2: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

The idea of obtaining a spectrum from a measurement may seem overwhelming, not least because signals in the natural world can contain infinitely many frequencies. However, such continuous signals can also be broken into infinitely many time steps and we can measure their behavior in time by sampling them at regular intervals over some limited time. In an exactly analogous way, measuring a spectrum is an exercise in sampling it at regular intervals in frequency over a limited frequency range. To understand how this comes about we need to consider the whole measurement process.

Consider once more the velocity signal from our cylinder wake. To measure this signal we take samples of it at regular intervals t. We already know that the maximum frequency we can observe in such a sampled signal is the Nyquist frequency, equal to half the sampling rate. Thus by sampling in time we already have set

the highest frequency we can measure as 1/(2t). (There may be problems, of course, if our original signal contains frequencies higher than this, so our measurement is aliased, but more about that later.)

Inevitably we can only take samples of the signal for a finite time called the  total sampling time T. We refer to this process of extracting a finite length piece of the signal as windowing (the idea being that we are looking at the signal through a window in time). The lowest frequency we can unambiguously infer from a windowed signal is one with a period that lasts the total sampling time. Thus, if N is the number of samples we took, then the total sampling time T = Nt and the lowest frequency we can measure is 1/T = 1/(Nt).Note that this also turns out to be the smallest difference in frequency we can infer from the windowed signal.

So when we sample the signal at time intervals of t over a total time T = Nt it turns out that we are also sampling its frequency content at intervals of 1/(Nt) up to a maximum frequency of 1/(2t).  As a practical example, if our velocity signal is being sampled at a rate of 10 Hz (t = 0.1 s) and we are taking the 32 samples shown then we have sampled its frequency content at intervals of 0.31 Hz = 1/(32×0.1 s) up to a maximum frequency of 5 Hz=1/(2×0.1 s).

Page 3: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

Now consider the problem of calculating the spectrum, i.e. expressing our sampled signal as a sum of sinusoids each of different amplitude and phase. Since the sinusoids will have a maximum frequency of 1/(2t) and a frequency interval of 1/(Nt), we will have  1/(2t) ÷ 1/(Nt) = N/2 of them. This makes good mathematical sense. Since we need two pieces of information (amplitude and phase) to define each sinusoid, we will have N pieces of information to obtain using the N samples of the signal that we originally took. Obtaining the mathematical expressions for the amplitude and phase in terms of the original sampled values of the signal can thus be thought of as an exercise in solving Nequations for N unknowns.  Performing the math, we find that the amplitude and phase of the nth sine wave, having a frequency  fn= n/(Nt),  is:

where the coefficients an and bn are given in terms of our original signal v(t) as:

Note that the index i in these expressions just references the samples that we took so, for example, i = 3 references the third sample we measured, v(3t). These expressions, for determining the amplitude and phase as a function of frequency, are referred to as the Discrete Fourier Transform. The discrete Fourier transform is closely related to the continuous Fourier transform used in analyzing linear systems and, for example, in controls and dynamic response problems. This close relationship makes the spectral analysis particularly useful when we use it in experiments that deal with such systems or problems. 

The expression for our original sampled signal in terms of the sum of these sinusoids is:

This expression (which effectively reverses the process of determining the amplitude and phase from v(t)) is referred to as the  Inverse Discrete Fourier Transform. Note that it contains one extra coefficient A0/2 that we didn't anticipate, apparently for zero frequency. Following through the expressions for an and bn for n = 0, however, you will find that this extra coefficient simply represents any mean value of the signal which cannot be accounted for in the sum of sinusoids.

The figure below shows spectra obtained by taking the discrete Fourier transform of our example velocity signal.

Page 4: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

Note that the spectra are plotted against frequency index n, Interpreting these spectra is not hard if you remember the meaning of the frequency index n plotted on the horizontal axis. Specifically n = 1 corresponds to a wave with a wavelength that fits one time into the sampling window, n = 2 is a wave that fits twice into the sampling window, and so on. The power spectrum shows large amplitudes for waves that fit 3 and 6 times into the sampling window, with phases of about -40 and 45 degrees respectively. Look at the sampled and windowed signal and see if you can identify these components in the original data by eye. Confirm in your own mind that, for a 10 Hz sampling rate, these peaks are occurring at frequencies of 0.94 Hz and 1.88 Hz.

Finally, note that the phase values only have meaning when the amplitude is non zero (a sine wave with zero amplitude looks the same whatever the phase is). Thus, in the present case, the phase values for frequency indices of 11 to 16 means little. 

4. Computing Spectra

In this, and the following section, we will look at some of the practical issues of computing spectra from a measured signal, with particular reference to LabView. We will examine a number of examples that involve LabView spectral analysis of sine-wave signals. We use these single frequency signals because they are easily understood and therefore reveal clearly both the capabilities and limitations of spectral analysis. However, don't forget that the real power of spectral analysis is that it can be applied to any signal, whatever form it has, and however many frequencies it contains.

Page 5: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

While the above equations for computing the discrete Fourier transform and its inverse are entirely correct, they are rarely used explicitly. This is because they contain a lot of redundant arithmetic. Much faster algorithms for computing the same results are usually used. These are called the Fast Fourier Transform (FFT) and  Inverse Fast Fourier Transform (IFFT). We won't describe these algorithms here and you don't need to consider programming them since they have been part of standard software packages ever since such packages have existed (an indication of how important and universal spectral analysis is). Such packages often scale and present FFT results differently, however, so it is important that you find out what your software does before you use it. Below we look at computing FFTs in Matlab and LabView.

4.1 MatlabSuppose the original samples of our signal in an array v with elements 1 to N. The command c=fft(v); computes the fast Fourier transform of v and places it in the complex array c. To get the above coefficients from c we have to scale it and separate it into real and imaginary parts. We would write

a=real(2*i*c/N);b=imag(2*i*c/N);

to get arrays a and b containing the coefficients an and bn (where the nth array element corresponds to the nth coefficient).  Note that in Matlab i refers to the square root of -1. With the coefficients an and bn it is a straightforward matter to go ahead and calculate the amplitudes and phases and plot their spectra.

Performing the inverse transform basically means reversing this process. Starting with arrays a and b containing the coefficients an and bn we would write...

c=(a+i*b)*N/2/i;v=ifft(c);       

...to recover the sampled time signal v. 

4.2 LabViewThere are many LabView functions that deal with computing FFTs, spectra and related quantities. For now we will concern ourselves only with the 'Spectral Measurements' express VI. This computes the exact amplitude and phase values defined above explicitly. You can demonstrate this for yourself by writing a short LabView program, as follows.

1. Open a blank vi.2. Right click on the empty block diagram and select 'Input' and then 'Simulate Sig'. This

will add a VI that simulates the measurement of a signal.3. Position the VI on the block diagram and a dialog box will open inviting you to set the

characteristics of the measured signal. The default setting is for 100 samples at 1 kHz of a 10.1 Hz sine wave with an amplitude of 1 and phase of zero. This is fine, except for the frequency which you should change to 50 Hz before clicking OK. Can you figure out

Page 6: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

what the frequency range and resolution of a spectrum calculated from this signal will be?

4. Now, to take the FFT of this signal, right click again (on a blank space) and select 'Analysis' and then 'Spectral'. Position this VI and an second dialog will open, asking you to pick the details of the spectral analysis you want. Under 'Spectral Measurement' change the selections to 'Magnitude (Peak)' (LabView's terminology for an amplitude spectrum), and 'Linear' (so that LabView doesn't take the log of the results). Under 'Window' choose 'None' (more about this later).

5. Connect the 'Sine' output of the Simulate Signal VI to the 'Signals' input of the Spectral Measurements VI. This completes the computational part of the code.

6. To plot some results, go to the front panel and add three graphs (for each, right click, select 'Graph Inds' and then 'Graph') and arrange them as you like.

7. Back on the block diagram, connect the first graph to the 'Sine' output of the Simulate Signal VI, and the second and third graphs to the 'FFT-Peak' and 'Phase' outputs of the Spectral Measurements VI. Your code is now complete. The final block diagram should look like that below.

Now go to the front panel and hit the run button. After a brief delay the results should appear much as shown below. Note that, with the exception of the name on the vertical axis of the phase plot (which you may wish to type in manually - just click on it), the plot axes and labels should automatically label themselves to sensible things when you first hit the run button.

Page 7: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

If you have trouble getting your code to run, you can download the version illustrated above, called spectralDemo.vi. You will see that the amplitude spectrum from the FFT shows a value of 1 right at 50 Hz, and a phase of -1.57 radians (= -/2 = -90 degrees) here. Everywhere else the amplitude is zero and the phase is meaningless (as discussed above).  Confirm in your own mind that you are happy with this result, i.e. that the signal in the first graph decomposes into just one cosine with an amplitude of 1 and a phase of -90 degrees.

Note that the Spectral Measurements VI is easily modified to output the spectra in any one of a number of standard forms. Double click on the Spectral Measurements VI to open the dialog and look at the options available. First, by checking the box on the lower left, you can change the output phase to be in degrees. Likewise, by changing the selection under 'Spectral Measurement' to 'Magnitude (RMS)', you can have the output amplitude spectrum multiplied by 1/√2 to indicate the r.m.s. values of the component sinusoids.

Alternatively you can also change the spectral measurement option to 'Power Spectrum' or 'Power Spectral Density', but be aware when you do this that the Spectral Measurements VI will

Page 8: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

lose the phase output, so you will have to delete the phase graph and clean up the wiring. Consistent with our definition above, the VI outputs spectral values equal to half the square of the amplitudes (½An

2) when the power spectrum option is selected. The power spectral density is the same as the power spectrum, but with the values divided by the frequency resolution, i.e. ½An

2(Nt). The power spectral density can be thought of as showing the 'power' per Hertz. This representation can be useful when measuring signals that contain a continuous distribution of frequencies. Such signals produce power spectral levels that depend on the frequency resolution implied by the windowing of the signal. Using the power spectral density avoids this problem.

The 'Spectral Measurement' portion of the dialog also allows you to change the result type from 'Linear' to 'dB'. With dB selected the VI outputs the spectral levels in terms of decibels. The term 'decibels' refers to a logarithmic scale, rather than a different set of units. Specifically, for quantities proportional to the amplitude, the level in decibels is 20log10(quantity). For quantities proportional to the amplitude squared, the level in decibels is 10log10(quantity). Thus selecting 'Magnitude (RMS)' and 'Power Spectrum' produces the same result in the amplitude spectrum when that result is presented in terms of dB.

4.3 Exercises using LabViewTo perform these exercises you will need to download and open the code spectralDemo.vi.

1. Generate plots of the amplitude and phase spectrum of a 30 Hz sine wave, with a phase of 45 degrees and an amplitude of 5, inferred from 100 samples of the signal measured at a rate of 1 kHz. Plot the phase spectrum in degrees. Explain why the phase spectrum is not 45 degrees at 50 Hz. Explain the significance of the phase spectrum at other frequencies.

2. For the sine wave in problem 1 replot, in linear form, the amplitude spectrum as an r.m.s. spectrum, a power spectrum, and as a power spectral density. Using the formulae given above show that values of each of these spectra at 30 Hz are consistent with the original amplitude of 5.

3. For the sine wave in problem 1 replot the amplitude (peak) spectrum and the power spectrum in terms of decibels. Using the formulae given above show that values of each of these spectra at 30 Hz are consistent with the original amplitude of 5.

4. Starting with the sine wave settings of question 1, change the Simulate Signal VI to generate a 30 Hz square wave. A non sinusoidal variation like this implies multiple frequencies in the spectrum, termed the fundamental (at 30 Hz) and the harmonics (at multiples of 30 Hz). Plot the amplitude and phase spectra for this case. Use the plots to obtain numerical estimates of the amplitude and phase of the fundamental and first two harmonics for this square wave. Is the amplitude of the fundamental larger or smaller than that for a sine wave of the same frequency and amplitude? Attempt to explain your answer.

5. Repeat question 4, but for triangular waveform.

5. Getting the Spectrum Right

Page 9: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

The ultimate objective of spectral analysis to determine the actual distribution of frequencies in a signal. This doesn't appear to be too difficult in the above examples, but these signals have been carefully chosen to avoid problems. Real signals may suffer from aliasing, may not fit well in the measurement window and may contain random elements or be corrupted by noise. Knowing how to handle these problems is key if you want your measured spectrum to be of some value. 

5.1 Avoiding Aliasing ErrorsIn section 3 we discussed how the maximum frequency we can observe in a sampled signal is the Nyquist frequency, equal to half the sampling rate. What happens then if the original signal contains higher frequencies? Do these frequencies simply not appear in the measured spectrum since they are outside its range, or do they somehow corrupt the measured spectrum causing error at the frequencies we can resolve? The second answer, unfortunately, is the correct one.

The LabView program spectralAliasing.vi  illustrates how this corruption occurs. You can download this, along with a second (needed) sub VI in the zip file spectralAliasing.zip. Make sure you have the second code (Sine Waveform without error check.vi) in the same directory when you run spectralAliasing.vi.

This program is very similar to the one we used to illustrate computing spectra. It uses the same Spectral Measurements VI to compute the amplitude spectrum of a sampled sinusoidal signal, and the same graph elements to plot the signal and its spectrum. The only difference is that the sampled signal is not generated using the Simulate Signal VI but by a combination of more basic elements. The reason we can't use the Simulate Signal VI here is that it contains safeguards that prevent it from simulating an aliased measurement - exactly what we want to do here.  Load the program spectralAliasing.vi and run it from the front panel.

Page 10: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

The default case, shown above, is a 50 Hz sine wave with an amplitude of 5 and a phase of 90 degrees being sampled at 1000 Hz for 0.1 seconds (100 samples). The actual points in the signal have been marked so it is clear where the samples are (you can easily change the plot format of a LabView graph by right clicking on it and selecting properties). The amplitude spectrum below shows exactly what it should - a value of 5 at a frequency of 50 Hz. We have no aliasing problems because the signal frequency is well below the Nyquist, of 500 Hz.

Press the 'Run Continuously' button (two nested arrows, just to the right of the run button) to repeatedly run the program, and click up on the frequency selector to increase the frequency to 130 Hz. The signal should change accordingly (showing 13 wavelengths in the graph), and the spike in the amplitude spectrum should obediently move to the right, to 130 Hz. Note that even though the spectrum is fine, the sampled signal is not quite as good as it was. This is because the higher we make the frequency the fewer samples are taken of each period of the wave.

Continue increasing the frequency to 450 Hz (the default frequency increment is 80 Hz). The subjective quality of the sampled signal will continue to degrade, but the spectrum should remain fine. What happens now if we raise the signal to 530 Hz, and then 610 Hz, and so on. Try this. Instead of continuing to increase, the spectral peak starts coming back down.

At 610 Hz you should see a picture like that above, with a spike in the spectrum at 390 Hz instead of 610. The reason is that, with less that two samples in every wavelength, samples of a high frequency signal look just like those from a low frequency one. You can see this very clearly if you go on increasing the signal frequency to 1010 Hz. The time between each sample is almost equal to the period of the wave, so the samples show only a very slow variation, apparently at 10 Hz.

Page 11: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

In general aliasing creates two problems. First, it can cause us to mistake a high frequency signal for a low frequency one. This is common, for example, when electrical interference from a computer contaminates a sensor signal. The interference (usually a signal at many MHz) can get aliased and appear as though it is part of the legitimate low frequency sensor signal, and therefore be misinterpreted as a fluctuation in velocity, temperature, or  whatever physical property we are trying to measure. Second, when a signal contains a broad range of frequencies, aliasing can corrupt the entire shape of the spectrum. If, in our example above, we had used a broadband signal with energy at all frequencies from zero to 1010 Hz in place of the sine wave, the spectral value at 610 Hz would have got added to that at 390 Hz, the value at 1010 Hz would be added to that at 10 Hz, and likewise at all other frequencies. We would have no way of separating these contributions and thus no way of extracting the true spectrum.

So how can we minimize the influence of aliasing on a spectral measurements? There are three measures we can take.

1. Take samples at a higher rate, so the Nyquist frequency exceeds the highest frequency in the signal. This is ideal, but not always possible since all A/Ds have maximum sampling rates. Also you may  not know what the highest frequency is. Signs that your sampling rate may be high enough are (i) that the spectral values you calculate at the highest frequencies are zero or almost zero (only works for broadband signals), or (ii) that spectra of the same signal measured at different sampling rates have the same shape. 

2. Use an analog electrical filter to remove all the frequencies in the signal above the Nyquist before you sample it. (While you don't get the whole spectrum in this case, at least the part of the spectrum you do get is uncorrupted).

Page 12: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

3. Be aware of the problem and alert to its possible presence. You may have to accept some minimal level of aliasing in your measurement. If you are aware that it is there, then you won't mis-interpret its effects.

5.2 Minimizing BroadeningBroadening of the spectrum describes what happens when a signal does not fit neatly into the measurement window. To see what this does we will use examples computed using the spectralDemo.vi introduced in section 4.2. The figure below shows (again) the output from this program in its default configuration (that shows an amplitude spectrum computed from 100 samples, taken at a rate of 1 kHz, of a 50 Hz sine wave with an amplitude of 1 and zero phase).

 

The spectrum looks perfect, but this is partly due to a lucky choice of parameters. The numerical Fourier transform treats the measured part of the signal as though it were part of an infinitely extending signal made up of repetitions of the measured part. At 50 Hz exactly 5 periods of the wave fit into the measurement window between t = 0 and 0.1 s, so this measured part of the signal exactly fits to its copy from 0.1 to 0.2 s which, in turn, fits to the copy from 0.2 to 0.3 s, and so on. The implied infinitely extended signal is just a continuation of the 50 Hz wave we measured, resulting in the perfect spectrum.

Of course this doesn't often happen in real life. The chances of picking a total measurement time that is an exact number of periods of the oscillation of a structure, or the flow rate in a fuel system are almost zero. Indeed, many signals we encounter in engineering measurement won't be periodic at all. So what happens in this case? Try re-running spectralDemo.vi but with a signal frequency to 45 Hz.

Page 13: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

Now there is an extra half period at the end of the measurement window, so the implied repeated signal has a jump at every repetition.

This rather ugly signal implies a range of frequencies (not just 45 Hz) and the spectrum we get reflects exactly that. There is still a peak around 45 Hz, but its amplitude is reduced and there are significant spectral levels over a whole range of surrounding frequencies. This is the problem of broadening.

Note that broadening doesn't affect signals that fall to zero at the ends of the measurement window (such as measurements from short duration phenomena like transients). Nor does it have much impact on signals where the amplitude spectrum varies smoothly from frequency to frequency, and there are no sharp spikes. However, when we have a signal containing one or more dominant frequencies (as in the present example) broadening can result in significant smoothing of the sharp spikes that would otherwise appear in the spectrum.

Page 14: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

In this case the effects of broadening can be minimized by multiplying the signal by a smooth function that goes to zero or nearly zero at the ends of the record, called a window function. There are a variety of different commonly used window functions. Some are listed in the table below and illustrated in the following figure. All these have the form

where where T is the total record length and the constants c0  , c1  , and c2 are as follows:

Window type c0 c1 c2

Blackman 1.0000 1.1905 0.1905Blackman-Harris 0.9790 1.1509 0.1833Exact Blackman 1.0000 1.1640 0.1801Hamming 1.0000 0.8519 0.0000Hanning 1.0000 1.0000 0.0000

The Spectral Measurements VI includes the option of using any one of these (and other) window functions, or no window function at all. The window function can be selected (using the drop-down list under 'Window') in the dialog box displayed by double clicking on the VI. Changing to a Hanning window (probably the most widely used) for our current 45 Hz example produces the effect shown below. The spectrum is not perfect, but much better than without a window function at all.

Page 15: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

5.3 Dealing with RandomnessThere are two kinds of randomness we have to deal with in measurements; unwanted noise that masks a sensor signal, and thus the variations in the physical quantity we are trying to detect, or randomness in the physical quantity itself, such as in the velocity of a turbulent flow or in the unsteady lift of a stalling wing. Both of these situations call for averaging, but of different spectral quantities.

We can eliminate unwanted noise from a repeating signal by measuring multiple repetitions, and then averaging them together before taking the spectrum. As long as each repetition of the signal appears at the same position in the window each time we measure it, then the repeated signal will average to its true value, where as the random noise fluctuations will average to zero. The same result can be achieved by calculating the spectrum of each repetition, and then averaging the raw spectral coefficients an  and   b n(before calculating amplitude and phase).

This exact situation is encountered when using computer data acquisition to measure the dynamic response of a structure. The response can be revealed for all frequencies, for example, by measuring the oscillations in time of the structure after it experiences an impulsive force (e.g. it is tapped with a hammer) and then calculating the spectrum (more about this later). There will be noise in the sensor not just from interference and electronics but also in the movement the structure picks up from other sources, such as building vibrations. So if the response is determined from a single measurement it will have uncertainties associated with this noise. Instead, the way to proceed is to repeat the measurement multiple times, triggering the data acquisition to start at the same instant (when the hammer hits, perhaps) each time, and then averaging the spectral coefficients. The more repetitions (averages) the lower the uncertainty in the spectrum will be.

Page 16: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

We can illustrate this process in LabView using the basic spectralDemo.vi program. After opening the program double click on the Simulate Signal VI and check the 'Add Noise' box. Note that 'Noise Type' should default to 'Uniform White Noise' with an amplitude of 0.6. Change the amplitude to 2.0. Run the program and your results should appear similar to that shown below.

So much noise has been added that the original 50 Hz sine wave is barely visible in the time trace. Even without averaging, however, the spectrum goes some way to separating that noise out - the amplitude spectrum still shows a clear peak at 50 Hz. We can go much further though by averaging. Double click in the Spectral Measurements VI and check the 'Averaging' box.  Under 'Mode' choose 'Vector' (this ensures averaging of the coefficients an and bn) and under 'Weighting' choose 'Linear' (just a regular average). Note that the 'Number of Averages' defaults to 10.

You can run the code at this point, but it won't take any averages. The problem is that the Spectral Measurements VI is expecting to receive 10 measured signals, and its only getting 1. To fix this, right click on an empty space in the block diagram, select 'Exec Ctrl' and then 'While

Page 17: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

Loop'. Click and drag a While loop surrounding all the program elements. When you release the mouse the loop will appear along with a 'Stop' button. We don't want this (we want the loop to stop when the averaging is done) so click on the stop button, and then hit delete. Finally connect the 'Averaging Done' output of the Spectral Measurements VI to the little stop sign left next to the while loop. Your final block diagram should appear as shown below.

Run the code (the 10 averages will whip by really fast), and you will see a dramatic reduction in the noise level in the spectrum. Note that the Simulate Signal VI always generates a sine wave with the same phase relative to the start of the measurement window, so there is no need to worry about triggering here.

Page 18: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

Try running 100 averages, and see what it does to the noise level. If you have a hard time getting your code working, then you can download the one used to generate this figure, spectralNoise.vi.

Sometimes the random part of a signal is just as important as any deterministic part. The flow velocity in the wake of a circular cylinder high speed may often consist of a periodic fluctuation associated with vortex shedding, super-imposed on random turbulence. In this circumstance we will likely want to know the spectrum of the turbulence as much as we want to know that of the vortex shedding. Another example can be found in measuring the dynamic response of a structure. A second way to get the response at all frequencies is to measure the spectrum of the random movements produced by the structure in response to randomly fluctuating force (this technique will be discussed in more detail later).

To obtain the average spectrum of a signal with random components, we average the amplitude squared (An

2) at each frequency, instead of the Fourier coefficients. This way the negative and positive fluctuations in the amplitude, produced by the randomness, don't cancel out. When the averaging is complete we can estimate the amplitude spectrum by taking the square root of these

Page 19: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

averages and the power spectrum as half these averages. Note that this type of averaging eliminates any phase information.

To demonstrate this type of averaging open spectralNoise.vi and double click on the Spectral Measurements VI and change the averaging mode to 'RMS'. Re run the code to produce a result like that below (for 10 averages).

Note that the phase plot now just contains zeros (since there is no phase information). We see that the average noise amplitude (at each frequency) is about 20% of that of the sine wave, and that it has a flat spectrum. Incidentally, the term 'white' noise refers specifically to noise with a flat spectrum like this. Note that the more averages we take the smoother and more accurate the spectrum will become.

5.4 Exercises

Page 20: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

1. A signal from a proximeter, used to sense the position of a beam structure, is being measured using an A/D converter and the spectrum calculated. The spectrum is calculated from a record of 1024 samples recorded at a rate of 100 Hz. (a) What will be the lowest non-zero frequency in the spectrum? (b) What will be the highest? (c) What will the smallest difference in frequency that will be detectable in the spectrum? (d) What is the highest permissible frequency in the proximiter signal (in Hertz) if aliasing is to be avoided, and what name is given to this frequency? (e) If higher frequencies are present, what can be done to avoid corrupting the spectrum. Give two possible solutions.2. For the situation in question 1: (a) Will a 40 Hz sine wave signal from the proximeter be aliased? (b) Will a 40 Hz square wave signal be aliased. To answer this, first run the code spectralDemo.vi to examine the frequency content of the square wave from 0 to 200 Hz. Plot the results and then give your explanation.

Audio Processing

The two principal human senses are vision and hearing. Correspondingly, much of DSP is related to image and audio processing. People listen to both music and speech. DSP has made revolutionary changes in both these areas.

Music The path leading from the musician's microphone to the audiophile's speaker is remarkably long. Digital data representation is important to prevent the degradation commonly associated with analog storage and manipulation. This is very familiar to anyone who has compared the musical quality of cassette tapes with compact disks. In a typical scenario, a musical piece is recorded in a sound studio on multiple channels or tracks. In some cases, this even involves recording individual instruments and singers separately. This is done to give the sound engineer greater flexibility in creating the final product. The complex process of combining the individual tracks into a final product is called mix down. DSP can provide several important functions during mix down, including: filtering, signal addition and subtraction, signal editing, etc.

One of the most interesting DSP applications in music preparation is artificial reverberation. If the individual channels are simply added

Page 21: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

together, the resulting piece sounds frail and diluted, much as if the musicians were playing outdoors. This is because listeners are greatly influenced by the echo or reverberation content of the music, which is usually minimized in the sound studio. DSP allows artificial echoes and reverberation to be added during mix down to simulate various ideal listening environments. Echoes with delays of a few hundred milliseconds give the impression of cathedral like locations. Adding echoes with delays of 10-20 milliseconds provide the perception of more modest size listening rooms.

Speech generationSpeech generation and recognition are used to communicate between humans and machines. Rather than using your hands and eyes, you use your mouth and ears. This is very convenient when your hands and eyes should be doing something else, such as: driving a car, performing surgery, or (unfortunately) firing your weapons at the enemy. Two approaches are used for computer generated speech: digital recording and vocal tract simulation. In digital recording, the voice of a human speaker is digitized and stored, usually in a compressed form. During playback, the stored data are uncompressed and converted back into an analog signal. An entire hour of recorded speech requires only about three megabytes of storage, well within the capabilities of even small computer systems. This is the most common method of digital speech generation used today.

Vocal tract simulators are more complicated, trying to mimic the physical mechanisms by which humans create speech. The human vocal tract is an acoustic cavity with resonate frequencies determined by the size and shape of the chambers. Sound originates in the vocal tract in one of two basic ways, called voiced and fricative sounds. With voiced sounds, vocal cord vibration produces near periodic pulses of air into the vocal cavities. In comparison, fricative sounds originate from the noisy air turbulence at narrow constrictions, such as the teeth and lips. Vocal tract simulators operate by generating digital signals that resemble these two types of excitation. The characteristics of the resonate chamber are simulated by passing the excitation signal through a digital filter with similar resonances. This approach was used in one of the very early DSP success stories, the Speak & Spell, a widely sold electronic learning aid for children.

Speech recognitionThe automated recognition of human speech is immensely more difficult

Page 22: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

than speech generation. Speech recognition is a classic example of things that the human brain does well, but digital computers do poorly. Digital computers can store and recall vast amounts of data, perform mathematical calculations at blazing speeds, and do repetitive tasks without becoming bored or inefficient. Unfortunately, present day computers perform very poorly when faced with raw sensory data. Teaching a computer to send you a monthly electric bill is easy. Teaching the same computer to understand your voice is a major undertaking.

Digital Signal Processing generally approaches the problem of voice recognition in two steps: feature extraction followed by feature matching. Each word in the incoming audio signal is isolated and then analyzed to identify the type of excitation and resonate frequencies. These parameters are then compared with previous examples of spoken words to identify the closest match. Often, these systems are limited to only a few hundred words; can only accept speech with distinct pauses between words; and must be retrained for each individual speaker. While this is adequate for many commercial applications, these limitations are humbling when compared to the abilities of human hearing. There is a great deal of work to be done in this area, with tremendous financial rewards for those that produce successful commercial products.

Radar Signal ProcessorThe signal processor is that part of the system which separates targets from clutter on the basis of Doppler contentand amplitude characteristics. In modern radar sets the conversion of radar signals to digital form is typically accomplished after IF amplification and phase sensitive detection. At this stage they are referred to as video signals, and have a typical bandwidth in the range 250 KHz to 5 MHz. The Sampling Theorem therefore indicates sampling rates between about 500 KHz and 10 MHz. Such rates are well within the capabilities of modern analogue-to-digital converters (ADCs).The signal processor includes the following components:

the I&Q Phase Detector, the Moving Target Indication and the Constant False Alarm Rate detection.

The complete proceeding may also be implemented as software in digital receivers.

Page 23: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

I&Q Phase-detector

MTIDetectorPlot-extractorPlot-processorPlot-combinerSensortrackerMultipleSensortrackerΣΔAz

ΔEl

Azimuth dataSSR plotstimeIFthresholdsdata fromother sensors(e.g. Weather)IntermediateFrequencybipolarvideounipolarvideoreportsplotstracks

Figure 1: Information flow in radar signal processingThe plot extraction and plot processing elements are the final stage in the primary radar sensor chain. The essential process is that of generating and processing plots as distinct from processing waveforms. The main components are:

the plot extractor or hit processor (translates hits from the signal processor to plots),

the plot processor (combines primary radar plots and minimises false plots) and

Page 24: wingsofaero.inwingsofaero.in/.../uploads/2018/12/Spectrum-of-the-sampled-signal.d… · Web view2. The Concept of a Spectrum. Consider the general expression for a sinusoid, using

the plot combiner (combines primary and secondary plots, uses complementary features to minimise false alarms).

Figure 2: The Plot Extraktor A 1000 contains all devices of the radar signal processing. (© Aerotechnica Ltd.)

The radar data chain can include the following devices: a sensor tracker (it combines some plots of a target to a track), and the Multiple Sensor tracker (it combines plots or tracks of other radar sensors).

(The distinction between a correlator and a tracker being, that in the case of a correlator the plot positions are not changed by the process.)Some of these devises can carried out as a software-modul after the digitalizing of the radar data. The Plot Extractor of the Ukrainian company Aerotechnica corporation (see the picture) is a Radar Data Extractors for all types of radars an is designed to upgrade analogue radars.