1 / 35

20-6554: Digital Signal Processing

20-6554: Digital Signal Processing. Chapter 8 FFT Processing. Go to section 2. 8.2. INTRODUCTION. This chapter focuses on the application of the FFT to digital spectral analysis, exploring the properties of signals and systems.

plato-russo
Download Presentation

20-6554: Digital Signal Processing

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. 20-6554: Digital Signal Processing Chapter 8 FFT Processing Go to section 2

  2. 8.2 INTRODUCTION This chapter focuses on the application of the FFT to digital spectral analysis, exploring the properties of signals and systems. It also uses the FFT to carry out digital filtering by Fast Convolution – an alternative to the time-domain approaches developed in earlier chapters. The use of the FFT in digital filtering is as follows: • Transform the input signal to the frequency-domain • Carry out the filtering in the frequency domain by modifying the amplitude and phase characteristics of the spectrum according to requirements • Take the inverse transform to recover the filtered output signal. Not necessarily superior to time-domain filtering – depends upon circumstances. next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  3. 8.3 A general-purpose FFT routine has been incorporated in spreadsheets supplied (e.g. sec8.2.1.xls) but can also use Excel’s built-in FFT function (accessed via ‘Tools’, ‘Data Analysis’, ‘Fourier Analysis’. You have to have already loaded the Analysis Toolpak add-in - via ‘Tools’, ‘Add-Ins’, ‘Analysis Toolpak’. Note that the speed of the FFT is considerably greater than for the basic DFT, and increasingly so for longer data series. next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  4. 8.4 SPECTRAL ANALYSIS 8.2.1 General Concepts A frequency-domain description of a signal should yield important information not apparent in the time-domain. Spectral analysis is descriptive, aiming to extract information from a signal rather than to modify it. It is often used to extract a signal from noise. Also used to investigate systems – the spectrum of a seismic signal, for example, can tell us a lot about the local geological structure. The FFT algorithm yields a set of discrete spectral coefficients – samples of the underlying continuous spectral function. If the signal consists of a number of waves each with an integral number of periods within the transform length, then each wave will be represented in the spectrum by a single spectral coefficient. If, however, this is not the case spectral spreading, or leakage, will occur. next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  5. 8.5 Spectral Leakage This can be demonstrated by generating a data set from three sinusoids, each with a period that corresponds exactly with one of the harmonics of the Fourier series: where This function has frequency components corresponding exactly to the 16th, 53rd and 211th harmonics. The FFT magnitudes (see sec8.2.1.xls) confirm this, showing a single spectral peak at these positions, with a spectral magnitude proportional to the amplitude. next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  6. 8.6 Spectra when wavelengths exactly fit data length See sec8.2.1.xls next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  7. 8.7 Spectra when wavelengths do not fit data length See sec8.2.1.xls – it’s clearer if you look at the numbers! next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  8. 8.8 Explaining spectral leakage next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  9. 8.9 next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  10. 8.10 Q8.4 (p280) • A 60Hz sinusoidal signal is sampled at 500 samples per second and analyzed using a 64-point FFT. • Which spectral coefficient will be the largest? • Which coefficient will be the next largest, and what is its relative size compared with the coefficient in part (a)? Give the answer in dB. • Find the sampling rate closest to 500 samples per second which will eliminate spectral leakage. (a) 60Hz signal sampled at 500Hz. Sampling theorem 64 point FFT 0.32 n=7 n=8 Hence, the largest coefficient will be n=8 60Hz

  11. 8.11 Q8.4 (continued) (b) The next largest coefficient is clearly n=7. The peak is at 60Hz, and the relative amplitude changes according to sinx/x, dropping to zero when x= The harmonic at n=8 is 0.32 of an interval from the peak, so the relative amplitude there will be: Similarly, the harmonic at n=7 is 0.68 of an interval from the peak, so the relative amplitude there will be: Therefore the relative size of the spectral coefficient at n=7 compared to n=8 is: Expressed in dB this is:

  12. 8.12 Q8.4 (continued) To find the sampling rate closest to 500 samples per second that will eliminate spectral leakage, we need the 8th spectral coefficient to be exactly at 60Hz. Hence Also, however

  13. 8.13 A Note on Harmonics vs Periods To demonstrate spectral leakage, and its cause, it is necessary to be able to select waves which have an exact number of periods within the duration of the data set (or not!). Following convention, the fundamental is the wave of the longest period that fits; higher frequencies are called harmonics. If we use the formula: is the amplitude of the ith wave is its harmonic number is the number of points and As n goes from 0 to N, there will be exactly complete cycles of the ith wave. Compare with where is the period of the ith wave, and again … but does not guarantee an EXACT number of cycles of the chosen wave period in N data points. next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  14. 8.14 Detection of a Signal in Noise When searching for a signal in noise - look at the spectrum. In the time-domain, signal and the noise are spread in time - hard to separate. In the frequency domain, however, a coherent signal is present over a small range of frequency components, whereas noise (if it is truly ‘white’) is spread uniformly across the spectrum. The second sheet in sec8.2.1.xls (‘Signal in Noise’) demonstrates this. For clarity, only one coherent wave is to be combined with noise. You specify the harmonic number, and amplitude as before: An harmonic number of 10 has been chosen, to give exactly 10 cycles of the wave in the space of the 512 data points chosen. The noise amplitude has been set at 0 so that the data consist of a pure sinusoid. The spectrum should therefore consist of a single non-zero ‘spike’. next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  15. 8.15 The harmonic number of 10 has been chosen giving exactly 10 cycles of the wave: The noise amplitude has been set at 0, and the data consist of a pure sinusoid. The spectrum below confirms this – it consists of a single non-zero ‘spike’ next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  16. 8.16 We can now ‘contaminate’ the signal with noise by increasing the noise amplitude relative to the signal. Noise amplitude 6, Signal amplitude 3 next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  17. 8.17 Noise amplitude 20, Signal amplitude 3 next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  18. 8.18 Noise amplitude 40, Signal amplitude 3 next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  19. 8.19 Note that even in the presence of significant noise, the spectrum can still clearly identify the presence of the signal. Note also that the noise has been added carefully, so that it is evenly spread around 0. In the code, this is done by means of: totl = totl + noiseamp * (Rnd() - 0.5) NB: the Rnd() function returns a random number between 0 and 1, so subtracting 0.5 will distribute the value around zero (it should have zero mean). If the added noise is not ‘mean-zero’, this happens (next page): next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  20. 8.20 Noise (mean NOT zero) Noise (mean zero) next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  21. 8.21 Tasks for this week 1. Review the material in Chapter 8, pages 251-260. 2. Download, and practice the use of, Sec8.2.1.xls. 3. Try the following exercises from the Problems section of Chapter 8 (p279/280): • Q8.1 – try adapting Sec8.2.1.xls for these 4 examples • Q8.2 – can skip this, as it’s not particularly relevant • Q8.3 – use Sec8.2.1.xls to check this • Q8.4 • Q8.5 – and try adapting Sec8.2.1.xls to check the results • Q8.6 • Q8.7 – use the second worksheet of Sec8.2.1.xls to experiment with different signal/noise ratios. next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  22. 8.22 • 4. Use the link on the module web page (http://maths.sci.shu.ac.uk/units/20-6554/) that generates some random harmonic components (optionally including noise). • The data are streamed directly to your browser in the form of an Excel file, so you should have no ‘import’ problem! • You can alternatively use these links directly: • http://maths.sci.shu.ac.uk/units/20-6554/assessments/makedata.php (no noise) http://maths.sci.shu.ac.uk/units/20-6554/assessments/makedata.php?noise=y (with noise) You should plot the data set, then try using Excel’s built-in Fourier Analysis tool (Tools, Data Analysis) to determine the harmonics present. After doing so, you can use the link provided to find out if you have got the right answer! http://maths.sci.shu.ac.uk/units/20-6554/assessments/datafiles.txt The spreadsheet you received will have a name made up of the date and time – look for that in the list to see what the answers for your data set are. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  23. 8.23 WINDOWING Unlike home-grown signals, which can be generated with exact harmonic components, signals which are measured experimentally comprise some (or many) non-harmonic components. Spectral leakage is therefore the norm, and it is common practice to carry out pre-processing of the data prior to spectral analysis. One technique is to taper the data set at each end smoothly to zero, to reduce any discontinuities, using a suitable window function. Multiplying the data by a time-domain window <=> convolving the spectrum of the data with that of the window function. Trade-off between broadening of individual spectral peaks and reduction of spectral leakage. No window => a rectangular window - narrowest main lobe, but large side lobes. Tapered window compromises between narrow main lobe & minimum side lobes. Two described here – the Bartlett (triangular) window and the Hamming window next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  24. 8.24 WINDOWING (contd) Triangular window: Hamming window: next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  25. 8.25 Do not have to taper all of the signal, can just taper the beginning and end section (typically 15%) of the signal – particularly when the signal is long. One half of the window is applied to the signal at each end. Example from the book (page 262): The data look like this (from Sec8.2.2.xls): next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  26. 8.26 The data look like this: and their spectrum looks like this: next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  27. Applying a triangular window (taper 50% - i.e. fully tapered): 8.27 As you can see, the window has produced extra spreading where previously there was none, but reduced it where there was some before. next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  28. and with a 15% taper: 8.28 The main peak is emphasised, but some spectral spreading occurs. next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  29. 8.29 De-trending the data In practical situations a final improvement is to de-trend the data – i.e. to remove any linear trend forcing the data to be zero-mean. In the book this step was not necessary for the data sets given because for these, the data are zero-mean and have no trend by definition. Use linear regression to find the best-fit straight line to the data. The least-squares coefficients (m,c) for the formula are: where the y-values are the data values, the x-values are the index numbers and N is the number of points. The straight-line values are then subtracted from the data values. The spreadsheet Sec8.2.2.xls implements all of the above techniques. next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  30. 8.30 Section 8.2.3: Zero-Filling In practice, the number of data points to be analysed is not always an exact power of 2, as required by the FFT. Zeros are added to the time-domain data set, taking the number of data points up to the next-higher power of 2. The effect of zero-padding can be illustrated by the workbook Sec8.2.3.xls, available from the website. To simulate Fig8.9, on p267, the data are now given by absolute period, rather than by harmonic number. A decay factor has also been added in to simulate the effect seen in Figure 8.9. next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  31. 8.31 As can be seen from the values entered into the spreadsheet for N (transform) and N (data), zero-padding has been used to increase the number of data points from 180 to 256. The FFT magnitudes for this data set, and for one in which the data have been padded to 512 points, are shown in the next two figures: N (data)=180; N (transform)=256 N (data)=180; N (transform)=512 The transforms are similar, with greater resolution but more leakage in the second figure. Trade-off between computation required and the clarity, but the basic information content is the same. next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  32. 8.32 The examples discussed in the grey boxes on p268-9 (Example 8.2) merit a brief discussion – they just confirm what we already know! On the general scale, , so is the maximum frequency. This is the same as Hz or rad s-1 Because the data are real, the number of points in the spectrum is N/2, where N is the number of time series data points. Figures 4.11/5.5/6.19: the numbers quoted for the minimum-length DFTs are arrived at just by estimating the number of points in h[n]. next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  33. 8.33 Section 8.3: Digital Filtering by Fast Convolution This section is longer than necessary – the process is pretty simple: Four steps are required: 1. Take the FFT of the input signal 2. Take the FFT of the impulse response of the desired filter 3. Multiply these together, using complex arithmetic 4. Take the inverse FFT of this product to yield the filtered time series next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  34. 8.34 Signal Segmentation This is a means of reducing the computation required when the impulse response is much shorter than the data set it is being applied to. The method is simple – zero-fill the impulse response / choose a time-series length which, when convolved together, give the right number of points to carry out an FFT (i.e. a power of two). Repeat the above for all chunks of data available, then simply add the results together. We are more concerned with understanding the basic techniques than with optimising the solution, this section is of less importance for us. It is good to be aware of the need for improving the efficiency of the algorithm used, but it is not central to the needs of this module. next page…. BSc 4 Mathematics. 20-6554: Digital Signal Processing

  35. 8.35 Tasks for this week Review the material in the book, section 8.2.2 (p261) to the end of Ch8 (p279). Attempt the following questions from the exercises at the end of the Chapter: Q8.8 Q8.9 Q8.10 - can use Sec8.2.1.xls to help with this Q8.11 Q8.12 Q8.13 Q8.14. Q8.15/16/17 can be skipped BSc 4 Mathematics. 20-6554: Digital Signal Processing

More Related