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

Similar documents
Lab 3 FFT based Spectrum Analyzer

The Fundamentals of Mixed Signal Testing

Integrators, differentiators, and simple filters

ECE 4670 Spring 2014 Lab 1 Linear System Characteristics

Lab 4 Digital Scope and Spectrum Analyzer

Laboratory Assignment 2 Signal Sampling, Manipulation, and Playback

Fourier Signal Analysis

EE 233 Circuit Theory Lab 3: First-Order Filters

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

EE 422G - Signals and Systems Laboratory

Experiment # 4. Frequency Modulation

Sampling and Reconstruction

LLS - Introduction to Equipment

Frequency and Time Domain Representation of Sinusoidal Signals

Discrete Fourier Transform (DFT)

Introduction to Lab Instruments

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

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

Understanding Digital Signal Processing

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

Princeton ELE 201, Spring 2014 Laboratory No. 2 Shazam

Signal Processing First Lab 20: Extracting Frequencies of Musical Tones

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

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

THE BENEFITS OF DSP LOCK-IN AMPLIFIERS

Experiment Five: The Noisy Channel Model

Coming to Grips with the Frequency Domain

Laboratory Assignment 4. Fourier Sound Synthesis

Frequency Domain Representation of Signals

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

Spectrum Analysis: The FFT Display

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

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

ENGR 210 Lab 12: Sampling and Aliasing

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

Application Note (A12)

Basic Signals and Systems

EET 223 RF COMMUNICATIONS LABORATORY EXPERIMENTS

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

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

Log Booklet for EE2 Experiments

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

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

3.2 Measuring Frequency Response Of Low-Pass Filter :

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

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

Class #16: Experiment Matlab and Data Analysis

DFT: Discrete Fourier Transform & Linear Signal Processing

Audio processing methods on marine mammal vocalizations

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

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

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

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

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

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

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

Notes on Fourier transforms

Laboratory Experiment #1 Introduction to Spectral Analysis

RLC Frequency Response

POLYTECHNIC UNIVERSITY Electrical Engineering Department. EE SOPHOMORE LABORATORY Experiment 3 The Oscilloscope

SAMPLING THEORY. Representing continuous signals with discrete numbers

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

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

SGN Audio and Speech Processing

Noise Measurements Using a Teledyne LeCroy Oscilloscope

P a g e 1 ST985. TDR Cable Analyzer Instruction Manual. Analog Arts Inc.

Project 0: Part 2 A second hands-on lab on Speech Processing Frequency-domain processing

Electrical & Computer Engineering Technology

ME 365 EXPERIMENT 8 FREQUENCY ANALYSIS

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

Fourier Series and Gibbs Phenomenon

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

Experiment # 2 Pulse Code Modulation: Uniform and Non-Uniform

ENGR 40M Project 3c: Responding to music

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

Experiment No. 2 Pre-Lab Signal Mixing and Amplitude Modulation

Signal Processing Toolbox

FFT Convolution. The Overlap-Add Method

When and How to Use FFT

GUJARAT TECHNOLOGICAL UNIVERSITY

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

Lab 6: Building a Function Generator

LAB 2 Machine Perception of Music Computer Science 395, Winter Quarter 2005

YEDITEPE UNIVERSITY ENGINEERING FACULTY COMMUNICATION SYSTEMS LABORATORY EE 354 COMMUNICATION SYSTEMS

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

EE 230 Lab Lab 9. Prior to Lab

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

Experiment Guide: RC/RLC Filters and LabVIEW

GEORGIA INSTITUTE OF TECHNOLOGY. SCHOOL of ELECTRICAL and COMPUTER ENGINEERING

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

FFT 1 /n octave analysis wavelet

CHAPTER 4 IMPLEMENTATION OF ADALINE IN MATLAB

MTE 360 Automatic Control Systems University of Waterloo, Department of Mechanical & Mechatronics Engineering

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

Lab 9 Fourier Synthesis and Analysis

Laboratory Experience #5: Digital Spectrum Analyzer Basic use

Lab 2: Digital Modulations

MASSACHUSETTS INSTITUTE OF TECHNOLOGY /6.071 Introduction to Electronics, Signals and Measurement Spring 2006

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

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 by Friday, March 14, at 3 PM or the lab will be marked late. Lab write-up submission, beginning of lab class Friday, March 14. 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, bit reversal addressing, and oscilloscope display synchronization 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." 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. 02/21/14 page 1

Experiment 1 Write your own in-place radix 2 FFT routine and evaluate its performance 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. (In our experience, this portion of the lab may take more than one week to code it is the most conceptually difficult part of the lab and will take some serious time to think about). 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 WN 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 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. Compare performance for your fft and the built-in fft using 1024 point FFTs, a fixed number of loops, and "tic" and "toc" (as in Experiment 1, step 4). Explain to yourself why one would be slower than the other. 4. Now, rebuild your FFT 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 why one would be slower than the other. 5. Demonstrate your in-place FFT program to the TA for sign off. 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. Experiment 2 Design and implement 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 decimation-in-time, 02/21/14 page 2

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 lease 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 frequency bin. { } = 2.22 dbm, so solve for ref. For a 1Vdc input, X[0] 2 = N 2 A 2. So 10log 10 X[0] 2 / ref 10log 10 { N 2 A 2 / ref}= 2.22 db. Thus ref = N 2 A 2 / (10 0.222 ). Now, some 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. 02/21/14 page 3

Experiment 3 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] is the k th frequency bin magnitude for the r th data window, then the averaged magnitude, A[k,r], is computed as: A[k,r] = (1- ) X[k,r] + A[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 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 4 Develop a Working Spectrogram Tool in MATLAB 1. Write a simple MATLAB code using the "spectrum" and "imagesc" 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 02/21/14 page 4

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.wav file provided to you by the TA. 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. Conclusions 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/21/14 page 5

Laboratory 3 TA Check-off Page (to be submitted with laboratory report) Student Name: Task 1.5 Demonstrate your working fft to the TA. Task 2.6 Demonstrate your working spectrum analyzer to the TA. Task 3.7 Demonstrate your spectrum analyzer with exponential decay to the TA. Task 4.3 Demonstrate your working spectrogram to the TA. 02/21/14 page 6