Lab S-2: Direction Finding: Time-Difference or Phase Difference

Similar documents
Lab S-3: Beamforming with Phasors. N r k. is the time shift applied to r k

Lab S-1: Complex Exponentials Source Localization

1 Introduction and Overview

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

Lab S-5: DLTI GUI and Nulling Filters. Please read through the information below prior to attending your lab.

Lab 8: Frequency Response and Filtering

Lab S-4: Convolution & FIR Filters. Please read through the information below prior to attending your lab.

Lab P-3: Introduction to Complex Exponentials Direction Finding. zvect( [ 1+j, j, 3-4*j, exp(j*pi), exp(2j*pi/3) ] )

Lab S-9: Interference Removal from Electro-Cardiogram (ECG) Signals

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

Signal Processing First Lab 02: Introduction to Complex Exponentials Direction Finding. x(t) = A cos(ωt + φ) = Re{Ae jφ e jωt }

Lab S-7: Spectrograms of AM and FM Signals. 2. Study the frequency resolution of the spectrogram for two closely spaced sinusoids.

Here are some of Matlab s complex number operators: conj Complex conjugate abs Magnitude. Angle (or phase) in radians

DSP First Lab 08: Frequency Response: Bandpass and Nulling Filters

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

1 PeZ: Introduction. 1.1 Controls for PeZ using pezdemo. Lab 15b: FIR Filter Design and PeZ: The z, n, and O! Domains

George Mason University ECE 201: Introduction to Signal Analysis

GEORGIA INSTITUTE OF TECHNOLOGY. SCHOOL of ELECTRICAL and COMPUTER ENGINEERING

Signal Processing First Lab 02: Introduction to Complex Exponentials Multipath. x(t) = A cos(ωt + φ) = Re{Ae jφ e jωt }

Lab 6: Sampling, Convolution, and FIR Filtering

Lab P-10: Edge Detection in Images: UPC Decoding. Please read through the information below prior to attending your lab.

Week 15. Mechanical Waves

Electrical & Computer Engineering Technology

ECE 2026 Summer 2016 Lab #08: Detecting DTMF Signals

Lab 15c: Cochlear Implant Simulation with a Filter Bank

Basic Signals and Systems

GEORGIA INSTITUTE OF TECHNOLOGY SCHOOL of ELECTRICAL and COMPUTER ENGINEERING. ECE 2025 Fall 1999 Lab #7: Frequency Response & Bandpass Filters

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

DSP First. Laboratory Exercise #2. Introduction to Complex Exponentials

Lab P-8: Digital Images: A/D and D/A

SIGNALS AND SYSTEMS LABORATORY 3: Construction of Signals in MATLAB

Chapter 17 Waves in Two and Three Dimensions

1 Introduction and Overview

GEORGIA INSTITUTE OF TECHNOLOGY. SCHOOL of ELECTRICAL and COMPUTER ENGINEERING. ECE 2026 Summer 2018 Lab #8: Filter Design of FIR Filters

DSP First. Laboratory Exercise #7. Everyday Sinusoidal Signals

(i) Understanding the basic concepts of signal modeling, correlation, maximum likelihood estimation, least squares and iterative numerical methods

Friedrich-Alexander Universität Erlangen-Nürnberg. Lab Course. Pitch Estimation. International Audio Laboratories Erlangen. Prof. Dr.-Ing.

Lakehead University. Department of Electrical Engineering

ECE 201: Introduction to Signal Analysis

Signal Processing First Lab 20: Extracting Frequencies of Musical Tones

Sound Waves and Beats

4: EXPERIMENTS WITH SOUND PULSES

Laboratory Assignment 4. Fourier Sound Synthesis

Electronics Design Laboratory Lecture #4. ECEN 2270 Electronics Design Laboratory

George Mason University Signals and Systems I Spring 2016

DSP First Lab 06: Digital Images: A/D and D/A

DSP First Lab 4a: Synthesis of Sinusoidal Signals Speech Synthesis

Lab 4 Fourier Series and the Gibbs Phenomenon

Pitch and Harmonic to Noise Ratio Estimation

Spectrum Analysis: The FFT Display

LAB 4 GENERATION OF ASK MODULATION SIGNAL

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

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering. EIE2106 Signal and System Analysis Lab 2 Fourier series

MAKE SURE TA & TI STAMPS EVERY PAGE BEFORE YOU START

Fourier Signal Analysis

Lab 3 FFT based Spectrum Analyzer

Time Delay Estimation: Applications and Algorithms

Statistical Signal Processing. Project: PC-Based Acoustic Radar

Sound is the human ear s perceived effect of pressure changes in the ambient air. Sound can be modeled as a function of time.

Advanced Audiovisual Processing Expected Background

CHAPTER 4 IMPLEMENTATION OF ADALINE IN MATLAB

Matching and Locating of Cloud to Ground Lightning Discharges

THE ELECTROMAGNETIC FIELD THEORY. Dr. A. Bhattacharya

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

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

The Formula for Sinusoidal Signals

Lab/Project Error Control Coding using LDPC Codes and HARQ

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

THE CITADEL THE MILITARY COLLEGE OF SOUTH CAROLINA. Department of Electrical and Computer Engineering. ELEC 423 Digital Signal Processing

HY448 Sample Problems

Lab 4 Digital Scope and Spectrum Analyzer

UNIVERSITY OF TORONTO Faculty of Arts and Science MOCK EXAMINATION PHY207H1S. Duration 3 hours NO AIDS ALLOWED

Laboratory Project 4: Frequency Response and Filters

Additive Synthesis OBJECTIVES BACKGROUND

ME 365 EXPERIMENT 8 FREQUENCY ANALYSIS

EE 422G - Signals and Systems Laboratory

Indoor Positioning by the Fusion of Wireless Metrics and Sensors

ME scope Application Note 01 The FFT, Leakage, and Windowing

ECE 5650/4650 MATLAB Project 1

MATLAB Assignment. The Fourier Series

Lecture 7 Frequency Modulation

Revision: August 8, E Main Suite D Pullman, WA (509) Voice and Fax

Properties of Sound. Goals and Introduction

UWB SHORT RANGE IMAGING

Lecture 3 Complex Exponential Signals

Discrete Fourier Transform

Spring 2018 EE 445S Real-Time Digital Signal Processing Laboratory Prof. Evans. Homework #1 Sinusoids, Transforms and Transfer Functions

Multiple Sound Sources Localization Using Energetic Analysis Method

Biomedical Signals. Signals and Images in Medicine Dr Nabeel Anwar

Fourier Series and Gibbs Phenomenon

Chapter 16. Waves and Sound

Revision: April 18, E Main Suite D Pullman, WA (509) Voice and Fax

ENGR 210 Lab 12: Sampling and Aliasing

describe sound as the transmission of energy via longitudinal pressure waves;

Wireless Communication Systems Laboratory Lab#1: An introduction to basic digital baseband communication through MATLAB simulation Objective

EE 422G - Signals and Systems Laboratory

THE SINUSOIDAL WAVEFORM

GE423 Laboratory Assignment 6 Robot Sensors and Wall-Following

Adaptive Systems Homework Assignment 3

GE U111 HTT&TL, Lab 1: The Speed of Sound in Air, Acoustic Distance Measurement & Basic Concepts in MATLAB

Transcription:

DSP First, 2e Signal Processing First Lab S-2: Direction Finding: Time-Difference or Phase Difference Pre-Lab: Read the Pre-Lab and do all the exercises in the Pre-Lab section prior to attending lab. Verification: The Exercise section of each lab should be completed during your assigned Lab time and the steps marked Instructor Verification signed off during the lab time. One of the laboratory instructors must verify the appropriate steps by signing on the Instructor Verification line. When you have completed a step that requires verification, demonstrate the step to your instructor. Turn in the completed verification sheet before you leave the lab. Lab Homework Questions: The Lab-Homework Sheet has a few lab related questions that can be answered at your own pace. The completed Lab-HW sheet should be turned in at the beginning of the next lab. 1 Pre-Lab Please read through the information below prior to attending your lab. Objective: The objective of this lab is to learn how the outputs from two spatially separated sensors that receive signals from the same source can be used to estimate the direction to the source of the signal. The key to this processing is phase difference or time difference of arrival (TDOA) at the two receivers. 1.1 Publishing MATLAB Code When documenting MATLAB code for lab reports, the publish feature in MATLAB provide an easy way to produce.html file directly from an M-file. This publish feature is provided with one of the tabs in MATLAB s edit window. The following help describes the process: http://www.mathworks.com/help/matlab/matlab_prog/publishing-matlab-code.html The basic idea is to write comments according to some simple formatting rules. The following example from the MATLAB documentation illustrates the process with an example that comes from DSP (i.e., summation of harmonic sinusoids in a Fourier series). edit(fullfile(matlabroot, help, techdoc, matlab_env,... examples, fourier_demo2.m )) Use the command above to open the M-file fourier_demo2.m in the MATLAB editor Run the fourier_demo2.m M-file to see the plots that it creates. Publish fourier_demo2.m to create fourier_demo2.html, and then open fourier_demo2.html in a web browser and view the plots that show the sums of harmonic sinusoids. 1.2 Overview There are four specific cases that will be considered in this lab: 1. Sinusoidal source where the receiver signals have different phases. 2. Sinusoidal source with a wide receiver separation so that phase ambiguities must be taken into consideration. 1 McClellan, Schafer and Yoder, Signal Processing First.

3. Speech signal at the source so that time difference of arrival (TDOA) must be estimated. 4. Noise signal at the source which requires a template matching method to find the TDOA. 1.3 Direction Finding Why do mammals have two ears? One answer is that a brain can process acoustic signals received at the two ears and determine the direction to the source of the acoustic energy. It might be tempting to think that the ears can sense direction based solely on amplitude changes, but phase plays a very important role also. Using sinusoids, we can describe and analyze a simple scenario that demonstrates direction finding in terms of phase differences. This same principle is used in many other applications including radars that locate and track airplanes. 1.4 Direction of Arrival (DOA) Sensing with Microphones Consider a simple measurement system that consists of two microphones that can both hear the same source signal. If the microphones are placed a small distance apart, then the sound must travel slightly different paths from the source to the receivers. When the travel paths have different lengths, the signals arrive at different times. Since time shift corresponds to phase, we say that the received signals arrive out of phase. The received signal at one microphone, called r.t/, is a delayed copy of the transmitter signal s.t/. If the time delay from source to receiver is sr, then we can write r.t/ D s.t sr / where s./ is the transmitted (sinusoidal) signal. 1 The travel time sr can be computed easily once we know the of sound and the locations of the source and receiver(s). We can compare the signals from two receivers in many different ways. Consider the case of one source transmitting the signal s.t/ to two receivers. The received signals could be labelled with subscripts 1 and 2: Receiver #1: r 1.t/ D s.t sr1 / Receiver #2: r 2.t/ D s.t sr2 / where sr1 is the propagation time from the source to Receiver #1, and sr2 the propagation time from the source to Receiver #2. Suppose that the geometry of the problem is planar as shown in Fig. 1. The two receivers are located on the y-axis at.0;0/ for receiver #1 and.0;d/ for receiver #2. The inter-sensor spacing.d/ is positive, i.e., d > 0. The source is located at a distance of d 1 at an angle of. Thus the distance from the source to the receivers is d 1 for source to receiver #1, and d 2 for source to receiver #2. With some elementary geometry (or complex number vector addition), it is relatively easy to derive the following formula for d 2 d 2 D d 1 s1 2d d 1 sin C d 2 d 2 1 (1) Now we must make some approximations that will lead to a simple result. When d 1 d, we can drop the second-order term to obtain 2d d 2 d 1 s1 sin (2) d 1 1 For simplicity we ignore propagation losses. Usually, the amplitude of an acoustic signal that propagates over a distance R is reduced by an amount that is inversely proportional to R or R 2. 2 McClellan, Schafer and Yoder, Signal Processing First.

Figure 1: Source with two receivers. The angle is shown as positive, but could be negative if the source lies in the fourth quadrant. When > 0 the signal arrives first at receiver #2. The two receivers on the y-axis cannot distinguish left from right, so we assume the source does not lie in the second or third quadrants. Next we approximation the square root because when d 1 d the term.2d=d 1 /sin is very small and we can use the first two terms of a Taylor series expansion for the square root p 1 D 1 1 2 C higher order terms (3) Thus, and we obtain a very simple formula for : d 2 d 1 1 1 2d 2 sin d 1 This difference in propagation distance leads to two observations: d 1 d 2 d 1.d 1 d sin/ ƒ d 2 D d sin (5) 1. The time it takes the source signal to propagate to the two receivers is different. Thus, if d 1 > d 2 the signal arrives first at receiver #2. Assuming that the velocity of propagation is c, the time difference is D 1 2 D Please determine this formula. The righthand side will depend on the inter-sensor separation d, angle, and velocity c. 2. Since time delay is related to phase, when the source signal is a sinusoid the phase is different at the two receivers. Once again, it is possible to write a simple formula for the phase difference: ' D ' 1 ' 2 D Once again, determine the formula for the righthand side of this equation, which will depend on the frequency!, as well as d,, and c. Pay attention to the sign of the phase with respect to time delay. Note: In a later section the 2-ambiguity of the phase will be an issue. In other words, since the phase of a sinusoid is ambiguous by integer multiples of 2, there is more than one value for the phase difference. (4) 3 McClellan, Schafer and Yoder, Signal Processing First.

It is useful to cross check the formulas that were derived above. For example, when the phase difference (or, equivalently, TDOA) is zero what do you expect to get for the angle? 1.5 Template Matching In some situations, it is hard to determine the time shift between two signals, e.g., when there is no prominent peak or other feature that can be tracked between the signals. For this case, we need a procedure to match a segment of one signal with the corresponding segment in the other signal. Consider the following problem where we want to find one vector inside of another one. For a specific case suppose that xx is a length-10 vector and yy is a length-30 vector. If the vector xx is inside of the vector yy, then there is some index k such that the subvector yy(k:k+9) is equal to xx. If we want to write a MATLAB function that finds the match, we must find the starting index k, given xx and yy. This requires that we test all possible values for k. For the sizes given above, there are 21 possible length-10 subvectors within the length-30 yy vector, i.e., yy(k:k+9) for k=1,2,3,...,21. In practice, the test should not be an equality test because real signals acquired at sensors always have a small amount of random perturbations in their values (called noise). As long as the difference yy(k:k+9)-xx is very small, we would have a match. One way to quantify very small is to use a metric such as the Average Magnitude Difference Function (AMDF) which was first popularized in speech processing for pitch period estimation. E AMD.k/ D 1 L LX ˇ ˇyŒn C k 1 xœn ˇˇ nd1 where L is the length of the shorter vector, xœn in this case, and k is the starting index in the longer vector. For each value of k, E AMD.k/ is a scalar value that measures the match. If there was a perfect match, explain why the minimum value of E AMD.k/ versus k is zero. The match may not be perfect, so the practical procedure is to do this test for many values of k, and then find the best match at the index of the minimum. Note: when yœn C k D 0 the value of E AMD.k/ is M x D 1 P L ˇ L nd1 ˇxŒn ˇˇ, so we should expect the minimum value of E AMD.k/ to be much less than M x. This fact can be useful in setting a threshold for detecting the minimum when the signals are noisy. 1.6 Random Parameters Generated by LabDFgen2015 A simple MATLAB function is supplied to generate random parameters for your work in this lab. [r1,r2,fs] = LabDFgen2015( UserID,Part) The first input is a string such as your login/userid in order to identify different individuals doing this lab; the second argument is an integer that selects one of the three parts of the Lab Exercise. 2 The output displayed in the MATLAB command window gives the values of the parameters needed in one of the specific sections below. For parts 2 and 3, the function also returns vectors for the two receiver signals r1 and r2, and the sampling rate fs. The function has been converted to MATLAB s p-code format to hide the MATLAB code, because the parameter generation process involves knowing the solution to the exercise. 2 Your instructor might require a fixed UserID so that there would be only one solution to the lab. 4 McClellan, Schafer and Yoder, Signal Processing First.

2 Lab Exercise For the instructor verification, you should demonstrate that you understand concepts in a given subsection by answering questions from your lab instructor. It is not necessary to do everything in the subsections, i.e., skip parts that you already know. The Instructor Verification is usually placed close to the most important item, i.e., the one most likely to generate questions from your instructor. 2.1 Direction from Phase Difference Use the LabDFgen2015(UserID,1) function with its second argument set to 1 to generate two phase measurements, along with an intersensor distance d, and the propagation velocity c. These values are displayed in the MATLAB command window. Use the theory of direction finding to determine the direction to the source./. Write your method and results (and explanation) on the verification page Instructor Verification (separate page) 2.2 Ambiguous Direction Start from the phases generated previously, i.e., LabDFgen2015(UserID,1). Since the phase of a sinusoid might not be unique, the same is true of the phase difference. By changing ', show that there is at least one more direction in the first or fourth quadrant that satisfies the equations used in the previous part. Note: this ambiguity occurs in this sensor array scenario because the sensor spacing is larger than 1 2, where D c=f is the wavelength of the propagating wave. Determine this second source direction. 2 /. Write your results (and explanation) on the verification page. Instructor Verification (separate page) 2.3 Template Matching Function Write a MATLAB function that can find the best location of a short vector inside of a long vector. The output of the function should be an integer index that gives the best estimate of the starting index of the matched subvector within the longer vector. The metric for matching should be the AMDF (Average Magnitude Difference function) criterion. An outline of the M-file is given in Fig. 2. Note: the plot function called in the middle of the function should only be used during debugging; once the function is working correctly that line should be commented out. The threshold should be a small number that depends on the expected noise level because the subtraction in E AMD produces errors on the order of the noise level. Picking the threshold to be 2 3 times the noise level would be a reasonable value. Use the following test case where the noise level is 0.05: vshort = 0.7*[1,1,-1,1,-1,1,1]; vlong = rand(1,20); vlong(6:12) = vshort; vlong = vlong + 0.05*randn(size(vLong)); % add noise If you turn off the noise, the function should give an exact match with E AMD D 0 at its minimum. Furthermore, in order to test whether the threshold works, make both vectors random so there would be no match. Instructor Verification (separate page) 5 McClellan, Schafer and Yoder, Signal Processing First.

function kshift = templatematch(vshort,vlong) % % length(vshort) must be less than (or equal to) length(vlong) % kshift = best estimate of the starting index % kshift can only be nonnegative % use kshift=-1 to indicate the No Match Condition when the AMDF is too big L = length(vshort); kend =?? %- depends on length(vlong) and length(vshort) for kk=1:kend E(kk) =?? end [Emin,kmin] = min(e); plot(0:kend-1,e),title( Diagnostic Plot of E vs. shift ) kshift =??; threshold =??; if Emin>threshold kshift = -1; end Figure 2: MATLAB code for template matching with AMDF. 2.4 Direction from a Speech Signal Source In this part, use the [r1,r2,fs]=labdfgen2015(userid,2) function with its second argument set to 2 to generate two time-shifted speech signals, along with parameter values for the intersensor distance d, the propagation velocity c, and the sampling rate f s. The values of distance d and propagation velocity c are displayed in the MATLAB command window. Determine the direction to the source./. Write your method and results on the verification page. Instructor Verification (separate page) 3 Homework: Direction from a Noise Signal Source Use the [r1,r2,fs]=labdfgen2015(userid,3) function with its second argument set to 3 to generate two time-shifted noise signals, along with an intersensor distance d, the propagation velocity c, and sampling rate f s. The values of distance d and propagation velocity c are displayed in the MATLAB command window. Use your template matching function (based on the AMDF) to obtain an estimate for the TDOA from which you can determine the direction./. Write your method and results on the Lab-HW page. In order to use your template matching function it is necessary to take a small part of one signal and try to find it within the other signal. One suggested approach would be to take the center-half of the first signal and match it to the second signal. Center-half means drop the first 25% and last 25% of the points in the vector. Once you get the best match, the shift index must be compensated for the center-half operation. Finally, the shift index must be converted to a time (in secs) using the sampling rate. 6 McClellan, Schafer and Yoder, Signal Processing First.

Lab Direction Finding INSTRUCTOR VERIFICATION SHEET Turn this page in to your instructor before the end of your scheduled Lab time. Name: UserID: Date: Part 2.1 Direction from phases of two sinusoids. Method and results. Verified: Date/Time: d D c D ' 1 D ' 2 D ' D 1 D Part 2.2 Second direction from phases of sinusoids. Method and results. 2 D Verified: Date/Time: Part 2.3 Exhibit your template matching M-file on a test case. Verified: Date/Time: Part 2.4 Direction from time-shifted speech signals. List the measured time shifts. Method and results. Verified: Date/Time: 1 D 2 D D D 7 McClellan, Schafer and Yoder, Signal Processing First.

Lab: Direction Finding LAB HOMEWORK QUESTION Turn this page in to your instructor at the very beginning of your next scheduled Lab time. Name: UserID: Date: Use your template-matching M-file to estimate direction when the transmitted signal is random noise. 1. Run the LabDFgen2015(UserID,3) function to obtain the two noise signals and the system parameters. List the system parameters below 2. Determine the relative shift index obtained from template matching with the AMDF. To describe how you found the shift, sketch a plot of AMDF versus shift.k/ that you can make in MATLAB. 3. Then convert the shift index to TDOA (in secs). 4. Determine the direction angle. Show the calculation: 5. Turn in this page at the very beginning of your next scheduled lab period. 8 McClellan, Schafer and Yoder, Signal Processing First.