Lab 3 FFT based Spectrum Analyzer

Similar documents
ECEn 487 Digital Signal Processing Laboratory. Lab 3 FFT-based Spectrum Analyzer

Integrators, differentiators, and simple filters

The Fundamentals of Mixed Signal Testing

Laboratory Assignment 2 Signal Sampling, Manipulation, and Playback

ECE 4670 Spring 2014 Lab 1 Linear System Characteristics

EE 422G - Signals and Systems Laboratory

Department of Electronic Engineering NED University of Engineering & Technology. LABORATORY WORKBOOK For the Course SIGNALS & SYSTEMS (TC-202)

Sampling and Reconstruction

Fourier Signal Analysis

Lab 4 Digital Scope and Spectrum Analyzer

ECE 2111 Signals and Systems Spring 2009, UMD Experiment 3: The Spectrum Analyzer

Lab S-8: Spectrograms: Harmonic Lines & Chirp Aliasing

EE 233 Circuit Theory Lab 3: First-Order Filters

Frequency and Time Domain Representation of Sinusoidal Signals

Experiment # 4. Frequency Modulation

Signal Processing First Lab 20: Extracting Frequencies of Musical Tones

Lab Report #10 Alex Styborski, Daniel Telesman, and Josh Kauffman Group 12 Abstract

LLS - Introduction to Equipment

Laboratory Assignment 4. Fourier Sound Synthesis

Princeton ELE 201, Spring 2014 Laboratory No. 2 Shazam

DSP First. Laboratory Exercise #11. Extracting Frequencies of Musical Tones

Hideo Okawara s Mixed Signal Lecture Series. DSP-Based Testing Fundamentals 6 Spectrum Analysis -- FFT

Basic Signals and Systems

Signals A Preliminary Discussion EE442 Analog & Digital Communication Systems Lecture 2

Experiment Five: The Noisy Channel Model

Coming to Grips with the Frequency Domain

Audio processing methods on marine mammal vocalizations

Frequency Domain Representation of Signals

Fall Music 320A Homework #2 Sinusoids, Complex Sinusoids 145 points Theory and Lab Problems Due Thursday 10/11/2018 before class

Spectrum Analysis: The FFT Display

Digital Video and Audio Processing. Winter term 2002/ 2003 Computer-based exercises

Discrete Fourier Transform (DFT)

SMS045 - DSP Systems in Practice. Lab 1 - Filter Design and Evaluation in MATLAB Due date: Thursday Nov 13, 2003

Understanding Digital Signal Processing

L A B 3 : G E N E R A T I N G S I N U S O I D S

Introduction to Lab Instruments

DFT: Discrete Fourier Transform & Linear Signal Processing

ENGR 210 Lab 12: Sampling and Aliasing

Physics 326 Lab 8 11/5/04 FOURIER ANALYSIS AND SYNTHESIS

ESE 150 Lab 04: The Discrete Fourier Transform (DFT)

EET 223 RF COMMUNICATIONS LABORATORY EXPERIMENTS

THE BENEFITS OF DSP LOCK-IN AMPLIFIERS

Noise Measurements Using a Teledyne LeCroy Oscilloscope

Lab P-4: AM and FM Sinusoidal Signals. We have spent a lot of time learning about the properties of sinusoidal waveforms of the form: ) X

Log Booklet for EE2 Experiments

EEL 4350 Principles of Communication Project 2 Due Tuesday, February 10 at the Beginning of Class

PROBLEM SET 6. Note: This version is preliminary in that it does not yet have instructions for uploading the MATLAB problems.

3.2 Measuring Frequency Response Of Low-Pass Filter :

Class #16: Experiment Matlab and Data Analysis

PART I: The questions in Part I refer to the aliasing portion of the procedure as outlined in the lab manual.

Introduction to Communications Part Two: Physical Layer Ch3: Data & Signals

Introduction to Digital Signal Processing (Discrete-time Signal Processing)

ENGR 40M Project 3c: Responding to music

Digital Signal Processing. VO Embedded Systems Engineering Armin Wasicek WS 2009/10

ESE 150 Lab 04: The Discrete Fourier Transform (DFT)

Application Note (A12)

Lecture 3 Complex Exponential Signals

Memorial University of Newfoundland Faculty of Engineering and Applied Science. Lab Manual

GEORGIA INSTITUTE OF TECHNOLOGY. SCHOOL of ELECTRICAL and COMPUTER ENGINEERING

MATLAB Assignment. The Fourier Series

Laboratory Experiment #1 Introduction to Spectral Analysis

Topic 2. Signal Processing Review. (Some slides are adapted from Bryan Pardo s course slides on Machine Perception of Music)

Group: Names: (1) In this step you will examine the effects of AC coupling of an oscilloscope.

STATION NUMBER: LAB SECTION: Filters. LAB 6: Filters ELECTRICAL ENGINEERING 43/100 INTRODUCTION TO MICROELECTRONIC CIRCUITS

RLC Frequency Response

SAMPLING THEORY. Representing continuous signals with discrete numbers

Contents. Introduction 1 1 Suggested Reading 2 2 Equipment and Software Tools 2 3 Experiment 2

Grid Power Quality Analysis of 3-Phase System Using Low Cost Digital Signal Processor

ECE 3155 Experiment I AC Circuits and Bode Plots Rev. lpt jan 2013

Electrical & Computer Engineering Technology

SGN Audio and Speech Processing

Fourier Series and Gibbs Phenomenon

14 fasttest. Multitone Audio Analyzer. Multitone and Synchronous FFT Concepts

Impulse response. Frequency response

Signal Processing Toolbox

ADSP ADSP ADSP ADSP. Advanced Digital Signal Processing (18-792) Spring Fall Semester, Department of Electrical and Computer Engineering

Mel Spectrum Analysis of Speech Recognition using Single Microphone

FFT Convolution. The Overlap-Add Method

Electrical and Telecommunication Engineering Technology NEW YORK CITY COLLEGE OF TECHNOLOGY THE CITY UNIVERSITY OF NEW YORK

ECE 440L. Experiment 1: Signals and Noise (1 week)

Lab 6: Building a Function Generator

When and How to Use FFT

DSP First Lab 03: AM and FM Sinusoidal Signals. We have spent a lot of time learning about the properties of sinusoidal waveforms of the form: k=1

GUJARAT TECHNOLOGICAL UNIVERSITY

Topic 6. The Digital Fourier Transform. (Based, in part, on The Scientist and Engineer's Guide to Digital Signal Processing by Steven Smith)

Experiment Guide: RC/RLC Filters and LabVIEW

Discrete Fourier Transform

Topic. Spectrogram Chromagram Cesptrogram. Bryan Pardo, 2008, Northwestern University EECS 352: Machine Perception of Music and Audio

ECE ECE285. Electric Circuit Analysis I. Spring Nathalia Peixoto. Rev.2.0: Rev Electric Circuits I

SGN Audio and Speech Processing

FFT 1 /n octave analysis wavelet

Lab 9 Fourier Synthesis and Analysis

CHAPTER 4 IMPLEMENTATION OF ADALINE IN MATLAB

TS9050/60. microgen. electronics TM FM Modulation and Spectrum Analyser

System analysis and signal processing

Notes on Experiment #1

Laboratory Experience #5: Digital Spectrum Analyzer Basic use

Lab 2: Digital Modulations

Michael F. Toner, et. al.. "Distortion Measurement." Copyright 2000 CRC Press LLC. <

Audio Visualiser using Field Programmable Gate Array(FPGA)

Transcription:

ECEn 487 Digital Signal Processing Laboratory Lab 3 FFT based Spectrum Analyzer Due Dates This is a three week lab. All TA check off must be completed prior to the beginning of class on the lab book submission due date listed below, or the lab will be marked late. Submit answers to the questions at the beginning of lab class on: Friday Mar. 1. Lab book write-up copy submission, beginning of lab class: Friday Mar. 15. Objectives The purpose of this lab is for each student to build a working audio spectrum analyzer and spectrogram using the built-in PC sound card and MATLAB. Principles of in-place computation FFT architecture and bit reversal addressing will be studied. The spectrum analyzer will operate in continuous mode, real time, in the audio range of 20 Hz to 20 khz. Reading Assignment 1. Oppenheim and Schafer chapters 8 and 9. 2. MATLAB online help and documentation on function "fft." 02/22/13 page 1

Introduction One of the most useful signal analysis tools is the spectrum analyzer. It allows us to directly look at the frequency content of a signal as it evolves over time. I believe that the frequency domain representation is the more natural view for human interpretation because of our familiarity with pitch, and tonal quality. If an oscilloscope gives a graphical representation of the time-domain version of a signal, then a spectrum analyzer can be considered a "frequency domain oscilloscope." It allows us to view the signal's frequency content. It generally takes much more sophisticated electronics or processing to build a spectrum analyzer than an oscilloscope. We will use the PC (with MATLAB) to transform our signal into the frequency domain using an FFT algorithm. You will use the efficient built-in MATLAB FFT function, and will also code your own FFT algorithm. You will compare performance of the two algorithms. Experiment 1 Build a spectrum analyzer using the built-in MATLAB FFT function. 1. Build a working real-time spectrum analyzer code based on your digital oscilloscope program from lab 1 and the MATLAB fft function. This fft implementation is a decimationin-time, in place, very efficient Cooley-Tukey factored N implementation. It uses radix 4 decomposition if possible. Bit reversal data reordering is handled internally. 2. Use only the left input channel data. 3. Using the MATLAB plot function, display the FFT magnitude squared (not the full complex number or real or imaginary part) on the computer monitor. In MATLAB don't use abs(x).^2 to compute magnitude squared, use real(x).^2 + imag(x).^2. This is faster in a real DSP processor implementation since a square root is not computed, and closer to how this would really be implemented in a DSP processor. Update the display at least once a second. Display only the positive frequency terms. Label the horizontal axis in Hz, calculated based on your sample frequency. The user should be able to specify the sample rate, and FFT length. Also, the vertical axis should be in either linear scale, or db, under user control. The plot should be updated continuously, with as fast a refresh rate as possible. 4. Modify your code so the display vertical axis is in dbm scale (This is decibels relative to 1 milliwatt. You will need to experimentally calibrate your ADC input so you know what the digital count is corresponding to a 1V input signal level. Let A be the integer number you get with a 1V dc input signal. Assume the impedance for your analog input to the ADC is 600 Ohms. Then a 1V d.c. input signal would be (1V) 2 /600 Watts, or 1.667 mw. Thus A 2 corresponds to 1.667 mw = 2.22 dbm. With this information you can figure out how to normalize your display to be in dbm. Whatever your A is, that integer count must correspond to 2.22 dbm. Let X[0] be the complex output of your N point FFT in the dc 02/22/13 page 2

frequency bin. 10log 10 { X[0] 2 / ref} = 2.22 dbm, so solve for ref. For a 1Vdc input, { } = 2.22 db. Thus ref = N 2 A 2 / (10 0.222 ). Now, some X[0] 2 = N 2 A 2. So 10 log 10 N 2 A 2 / ref sound cards will not pass a dc voltage, and the function generator will not output a dc signal, so you will need to use a sinusoidal signal which has an RMS level of 1V. Comment on why the dbm display mode might be a good idea for a power spectrum analyzer. Note that you may need to add a small constant to the FFT magnitude before taking the logarithm to avoid very large negative values when the ADC output is zero. 5. Evaluate and compare the computational speed performance for FFT lengths of 1024 points and 1021 points. This can be done by modifying our code to run for a fixed number of plot updates (say 100) and timing the full run using the "tic" and "toc" functions. Explain any performance differences you observe between the two FFT lengths. 6. Demonstrate your running program to the TA using two analog input signals of your choosing which have different frequency content. Experiment 2 Perform signal analysis with your power spectrum analyzer, and improve the design. 1. Verify proper operation by using a sine wave input from the function generator and observing proper positioning of the spectrum peak as you seep the frequency. Verify that the highest frequency you can display, at the far right of your oscilloscope display, corresponds to half of the sample frequency. Record your observations. 2. Using a square wave signal with fundamental frequency of about 200 Hz, use your spectrum analyzer to verify that this signal has the correct continuous-time Fourier series coefficients as described in your ECEN 380 textbook. Record your observations and have the TA verify them. 3. Analyze the spectrum of some CD music passages. What conclusions do you draw regarding the time variation of the spectrum, or the relationship between specific instruments, voice, and their corresponding spectra? 4. Analyze the spectrum of the Morse Code recording. Record your estimates of the center frequencies for each signal present. 5. Add an exponential decaying time average feature to your spectrum analyzer. If X[k,r] 2 is the k th frequency bin magnitude squared (power) for the r th data window, then the averaged power, P[k,r], is computed as: P[k,r] = (1-α) X[k,r] 2 + α P[k,r-1], where 0 α<1. α=0 implies no averaging, while larger values of α imply a longer averaging window over time. 6. Using exponentially averaging, analyze the spectra of the Morse code signal and some CD music, and your speech, for several of values of α (e.g. 0, 0.7, 0.9, 0.99), and comment on 02/22/13 page 3

what advantages or disadvantages this method has. For the speech signal use the microphones and pre-amplifiers provided in the lab. 7. Demonstrate the exponential averaging spectrum analyzer to the TA. Experiment 3 Develop a Working Spectrogram Tool in MATLAB 1. Write a simple MATLAB code using the spectrum and imagesc or spectrogram functions to display frequency content with respect to time for a sampled audio signal. You must select window length, window overlap percentage, and window shape for good performance. Due to the delay time between sampled window blocks using the built-in PC ADC, it will not be possible to make this work continuously, but you should collect several seconds of data from the ADC and display the computed spectrogram in a single image plot. 2. Use your spectrogram tool to analyze speech. You will need to use a preamplifier and microphone to drive the PC's ADC input. Study the difference between your own spoken vowel sounds and fricatives ("s", "sh", "f", etc.), and plosives ("p", "t", "d", etc.). Make sure you have designed the spectrogram so you can see the fundamental and harmonic structure in the vowel sounds. Comment in your lab book on what you have leaned and observed regarding the structure of human speech. 3. Use your spectrogram tool to decode a message GeekCubed.wav file found on the class web page. You will have to change your code to accept a.wav file as an input rather than using the ADC input. Demonstrate your working spectrogram to the TA, and let him know what message you decoded in order to pass off this experiment. Experiment 4 Write your own in-place radix 2 FFT routine and evaluate its performance You have written (for homework) a recursive FFT code. This approach is never used in practice where speed or memory use are critical issues. You will now write an in-place code which is the same structure used by high speed dedicated DSP processors. For the calling sequence definitions we will use as a template the optimized assembly language fft code, "cfftr2.asm" used for the Texas Instruments TMS320C6701 DSP processor. The FFT architecture will correspond to figure 9.15 in your textbook. 1. Carefully read the prolog of the file "cfftr2.asm" to get the calling sequence and data structures right. Note particularly that you must a) pre-compute and provide as an input parameter the sine-cosine table, w, (i.e. the W N k FFT kernel values), b) perform bit reversal addressing to de-scramble the output order, and c) put the sine-cosine table, w, in bit reversed order. You will need to pre-compute a bit reversed addressing look up table, so that bit 02/22/13 page 4

reversed offsets do not need to be computed on the fly in real time. 2. Write a new MATLAB subroutine that functions identically, and has the same calling sequence as the FFT function in cfftr2.asm. This should be an in-place radix two code. Be careful about the difference in array index bases in MATLAB and the mathematical notation (zero based in math and C, one based in MATLAB). 3. Rebuild your spectrum analyzer program (with oscilloscope output) using your in-place FFT function. Verify proper operation by observing signals with known spectra from the previous experiments. 4. Compare performance for your fft and the built-in fft of Experiment 2 using 1024 point FFTs, a fixed number of display loops, and "tic" and "toc" (as in Experiment 1, step 4). Explain in your lab book why one would be slower than the other. 5. Now, rebuild your spectrum analyzer using a "for" loop implementation of the direct DFT sum (this can be written in about four lines of code). Using N = 1024, "tic", and "toc" measure performance for this non-fft implementation and compare with your in-place FFT. Explain in your lab book why one would be slower than the other. 6. Demonstrate your in-place FFT program to the TA for sign off. 7. An award (of edible type) will be given for the fastest implementation of the full in place FFT architecture. Hint: This MATLAB subroutine does not have to be long. If you get the butterfly branch indexing right, it consists of just 3 nested "for" loops. If you get stuck, ask the TA to show you a "pseudo code" note on how to structure it. Conclusions Write a paragraph or two of conclusions for your lab experience. Discuss any additional implications of what you observed. What other applications can you see for using a spectrum analyzer? What improvements could be made to the basic design to make it more usable? Describe what you feel are the important principals demonstrated in this lab, and note anything that you learned unexpectedly. What debug and redesign procedures did you need to perform to get it to work? 02/22/13 page 5

Questions (Due at beginning of second lab session) 1. What are the differences between the form your FFT coefficient table (w) must take and a normal table of values, WN k, 0 k N 1? 2. Submit a MATLAB code function that will generate a bit reversal indexing table. Verify that it works, and explain in English how it works. 3. What can the MATLAB fft function do that yours will not be able to do? How do they do it and still maintain fft computational efficiency? 4. Why is an in-place implementation of an FFT preferred in a real-world application? 02/22/13 page 6