UNIVERSITY OF WARWICK

Similar documents
UNIVERSITY OF WARWICK

Electrical & Computer Engineering Technology

Detecting the Position and Number of Sharks in the Sea Using Active Sound Navigation and Ranging (SONAR) Technique

ELT COMMUNICATION THEORY

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

LABORATORY - FREQUENCY ANALYSIS OF DISCRETE-TIME SIGNALS

Problem Set 1 (Solutions are due Mon )

Sound synthesis with Pure Data

Data Analysis in MATLAB Lab 1: The speed limit of the nervous system (comparative conduction velocity)

Synthesis: From Frequency to Time-Domain

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

Principles of Communications ECS 332

George Mason University Signals and Systems I Spring 2016

EXPERIMENT 4 INTRODUCTION TO AMPLITUDE MODULATION SUBMITTED BY

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

Biomedical Signals. Signals and Images in Medicine Dr Nabeel Anwar

DSP First. Laboratory Exercise #7. Everyday Sinusoidal Signals

Massachusetts Institute of Technology Dept. of Electrical Engineering and Computer Science Spring Semester, Introduction to EECS 2

ECE 5650/4650 MATLAB Project 1

CG401 Advanced Signal Processing. Dr Stuart Lawson Room A330 Tel: January 2003

Instruction Manual for Concept Simulators. Signals and Systems. M. J. Roberts

Fourier Series and Gibbs Phenomenon

Presentation Outline. Advisors: Dr. In Soo Ahn Dr. Thomas L. Stewart. Team Members: Luke Vercimak Karl Weyeneth. Karl. Luke

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

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

Discrete Fourier Transform (DFT)

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

Signal Processing. Introduction

DFT: Discrete Fourier Transform & Linear Signal Processing

1.5 The voltage V is given as V=RI, where R and I are resistance matrix and I current vector. Evaluate V given that

Lab 4 Fourier Series and the Gibbs Phenomenon

Figure 1: Block diagram of Digital signal processing

Project 2 - Speech Detection with FIR Filters

MATLAB Assignment. The Fourier Series

ECE 5650/4650 Exam II November 20, 2018 Name:

Laboratory 5: Spread Spectrum Communications

EGR 111 Audio Processing

ESE531 Spring University of Pennsylvania Department of Electrical and System Engineering Digital Signal Processing

Window Method. designates the window function. Commonly used window functions in FIR filters. are: 1. Rectangular Window:

1. In the command window, type "help conv" and press [enter]. Read the information displayed.

Problems from the 3 rd edition

ELT COMMUNICATION THEORY

Attia, John Okyere. Plotting Commands. Electronics and Circuit Analysis using MATLAB. Ed. John Okyere Attia Boca Raton: CRC Press LLC, 1999

Laboratory Assignment 2 Signal Sampling, Manipulation, and Playback

ECE438 - Laboratory 7a: Digital Filter Design (Week 1) By Prof. Charles Bouman and Prof. Mireille Boutin Fall 2015

Laboratory Assignment 5 Amplitude Modulation

Advanced Test Equipment Rentals ATEC (2832)

Digital Signal Processing PW1 Signals, Correlation functions and Spectra

Frequency Domain Representation of Signals

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

DIGITAL SIGNAL PROCESSING TOOLS VERSION 4.0

ELEC3104: Digital Signal Processing Session 1, 2013

Experiment 2: Electronic Enhancement of S/N and Boxcar Filtering

LAB 2 SPECTRUM ANALYSIS OF PERIODIC SIGNALS

Fourier Signal Analysis

Digital Signal Processing ETI

Set-up. Equipment required: Your issued Laptop MATLAB ( if you don t already have it on your laptop)

Modulating Signal by Matlab. Amplitude modulation(am)

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

EE477 Digital Signal Processing Laboratory Exercise #13

Digital Signal Processing

Signal Processing. Naureen Ghani. December 9, 2017

DSP Laboratory (EELE 4110) Lab#10 Finite Impulse Response (FIR) Filters

Laboration Exercises in Digital Signal Processing

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

Measuring Modulations

Lakehead University. Department of Electrical Engineering

Experiment Five: The Noisy Channel Model

Project I: Phase Tracking and Baud Timing Correction Systems

Digital Signal Processing ETI

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

Concordia University. Discrete-Time Signal Processing. Lab Manual (ELEC442) Dr. Wei-Ping Zhu

ELT DIGITAL COMMUNICATIONS

ELT Receiver Architectures and Signal Processing Fall Mandatory homework exercises

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

ELT DIGITAL COMMUNICATIONS

Universiti Malaysia Perlis EKT430: DIGITAL SIGNAL PROCESSING LAB ASSIGNMENT 1: DISCRETE TIME SIGNALS IN THE TIME DOMAIN

Massachusetts Institute of Technology Dept. of Electrical Engineering and Computer Science Fall Semester, Introduction to EECS 2

Laboratory 7: Active Filters

Signal Processing Toolbox

EEO 401 Digital Signal Processing Prof. Mark Fowler

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

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

EBU5375 Signals and Systems: Filtering and sampling in Matlab. Dr Jesús Requena Carrión

6.S02 MRI Lab Acquire MR signals. 2.1 Free Induction decay (FID)

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

Laboratory Assignment 4. Fourier Sound Synthesis

TIMA Lab. Research Reports

ECEGR Lab #8: Introduction to Simulink

Adaptive Systems Homework Assignment 3

Spring 2018 EE 445S Real-Time Digital Signal Processing Laboratory Prof. Evans. Homework #2. Filter Analysis, Simulation, and Design

SIGNALS AND SYSTEMS LABORATORY 3: Construction of Signals in MATLAB

EE 422G - Signals and Systems Laboratory

Understanding Digital Signal Processing

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

Exploring QAM using LabView Simulation *

OFDM Systems For Different Modulation Technique

Agilent N7509A Waveform Generation Toolbox Application Program

AC : FIR FILTERS FOR TECHNOLOGISTS, SCIENTISTS, AND OTHER NON-PH.D.S

ELEC3104: Digital Signal Processing Session 1, 2013

Transcription:

UNIVERSITY OF WARWICK School of Engineering ES905 MSc Signal Processing Module (2004) ASSIGNMENT 1 In this assignment, you will use the MATLAB package. In Part (A) you will design some FIR filters and use them to process some Amplitude Modulated (AM) Signals. In Part (B) a matched filter will be designed and used to detect some signals buried in noise. Assignment reports are to be submitted to the postgraduate secretary, room F313, by the submission deadline: 3pm, Friday, Week 7, 12th November 2004. You may download copies of this document and useful files from the web: http://www2.warwick.ac.uk/fac/sci/eng/staff/rcs/msc/ CONTENTS 1. PRESENTATION OF RESULTS. 2. PART (A): AM SIGNALS AND FILTERING 3. PART (B): MATCHED FILTER. 1. PRESENTATION OF RESULTS. 1.1 AM Signals and Filtering. (25% of marks) Work through the attached schedule and fill in the answer boxes. Attach the requested graphs to the end and submit together with the report required on the Matched Filter. 1.2 Matched Filter. (75% of marks) Write a short report on the design and use of the filter. Include the results requested in Section 3. 2. PART (A): AM SIGNALS AND FILTERING The schedule follows:- 1

UNIVERSITY OF WARWICK School of Engineering ES905 Signal Processing, Assignment 1, Part A: AM Signals and Filtering Name: Date: Introduction The exercise concerns the synthesis of some signals that are commonly found in communications systems. You will be adding noise to these signals. Filters will be designed to extract sinusoidal frequencies from the signals, and the noise content of the signals will be examined. You may plug headphones into the sockets at the front of some computers so that you can listen to the signals that you are observing as graphs on the screen. Matlab will be used extensively in this exercise. Before beginning, copy files: lab2_fir.m, lab2_synth.m, lab2_process.m, lab2_snr.m and noise_data.txt to your working directory. If you are in F211, F215 or the MSc workroom you can copy these from P:\course files\es905\ to your own directory on drive H:. You can do this using the copy facility of Explorer. It is probably easiest to copy the whole ES905 folder across to H:. For other computers, try to access http://www2.warwick.ac.uk/fac/sci/eng/staff/rcs/msc/ and copy the files as instructed. FIR Filter Design (File: lab2_fir.m) In this first experiment you are going to extract two sinusoids from a signal containing two added sinusoids. You will design FIR filters using the Remez exchange algorithm. In the lectures we studied a method to design FIR filters using frequency plane specification, and a Fourier series technique to obtain the filter s coefficients. Today you will use a CAD method which works by minimising the differences between the specified and actual filter responses. Open a Matlab window (Double click on the icon) and an Editor window to lab2_fir.m (Double click on the file while viewing the contents of your H: drive). Alter the position and size of these windows so you can see them together. You will need to work with the files you copied from the P: drive, so in the Matlab window type cd H:\folder or cd H: etc depending on where these files have been saved. Part 1 of the code concerns the synthesis of the signal to be filtered. Its specification is: First signal, x1, has frequency, = 100Hz, peak amplitude = 1V Second signal, x2, has frequency, x2 = 400Hz, peak amplitude = 1V Sampling frequency, fs = 2000Hz (ie folding frequency ff > 400 >,100Hz) Combined signal, x = x1 + x2. fs = 2000; t = 0:(1/fs):0.1; %Set up sampling intervals over a 0.1s period x1 = sin(2*pi*100*t); x2 = sin(2*pi*400*t); x = x1 + x2; subplot(3,1,1), plot(t,x) %Plot the signal against time title('the combined signal, x'); 2

%Wait until <return> is pressed Run this part of the code by typing lab2_fir at the Matlab prompt. The program will wait at the. Alternatively cut the required code and paste it to the Matlab window. Observe the signal. Does it appear to be correct? Part 2 of the code concerns the specification of the 1 st filter. This will be low-pass with a nominal cut-off midway between 100Hz and 400Hz. However, for practicality, separate pass 0 to 225Hz), transition (225 to 275Hz), and stop bands (275 to folding frequency), are specified in vector: fhz0. fhz0 = [0 225 275 fs/2]; These are converted to be non-dimensional: f0 = fhz0/(fs/2); Next a vector containing the required gain of the filter at the specified frequencies appears. Eg Lowpass: [1 1 0 0], high-pass: [0 0 1 1], band-pass [0 0 1 1 0 0]. ml0 = [1 1 0 0]; Next the filter coefficients, brl are calculated. Notice the specification vectors f0 and ml0. The 60 is the order of the filter. [brl] = remez(60, f0, ml0); Observe how good the filter is by comparing the specification with its actual spectrum. fhz1 = linspace(0, fs/2, 50); om1 = 2*pi*fHz1; z = exp(sqrt(-1)*om1/fs); ml = abs(polyval(brl,z)); subplot(3,1,2), plot(fhz0, ml0, fhz1, ml) title('spectrum of low-pass filter'); ylabel(' G '); xlabel('frequency (Hz)'); Try designing some filters with different orders eg 6 and 20. Comment on the effect on the frequency response of changing the filter s order. Now return to filter order 60 and filter the signal to extract the low frequency sinusoid. y1 = filter(brl,1,x); subplot(3,1,3), plot(t,y1) title('the extracted low frequency signal, x'); 3

Comment on the lack of output for the 1 st 15ms. Now design and implement a high-pass filter to extract the 400Hz sinusoid from the signal. Plot three graphs:- Input signal against time; Modulus of filter gain against frequency; Output signal against time. Obtain a printout of these on a single sheet of A4. Attach this to your report. Hint: (i) (ii) In the editor, copy the code for the low pass filter and modify it Display the 3 graphs, are they correct? Are the titles and labels correct? If so then give Matlab the command print and retrieve your hardcopy. Synthesise a Noisy AM Signal (File: lab2_synth.m) Read the file containing a random signal (noise) into array A. View and listen to a sample of the noise. %%% Read data from file produced by C program into 1 x Flength array fid = fopen('noise_data.txt','r'); %open the file [A,Flength] = fscanf(fid,'%f',[1,inf]); %read the data into A A = A/300; A((Flength+1):(2*Flength)) = A; %adjust noise level and length plot(a(1:128)) %plot the 1 st 128 noise samples. title( Noise ); ylabel( Amplitude ); xlabel( Time (s) ); soundsc(a); Set a sampling frequency of 4kHz and create a 500Hz carrier wave. %%% Create carrier sinewave of length: 4.0secs, frequency: 500Hz fs = 4000; %sampling frequency 4000Hz t = 0:(1/fs):4.0; %create 'time' samples x1 = sin(2*pi*500*t); %create a 500Hz sinewave carrier subplot(3,1,1), plot(t(1:128),x1(1:128)) title('sample length of carrier wave'); soundsc(x1) Create a message signal. This will be an 80Hz sinusoid. Notice that its maximum amplitude has been limited to 0.3V. This will limit the modulation depth of the AM wave to ka = 0.3 as the carrier has a peak amplitude of 1V. AM wave, s( t) = Ac [1 + kam( t)]cos(2π f ct), where k a controls the modulation depth, f c is the carrier frequency, A c is the carrier peak amplitude, and m(t) is the message signal. %%% Create message signal sinewave of length: 4.0secs, frequency: 80Hz ka = 0.3; % modulation depth x2 = ka*sin(2*pi*80*t); subplot(3,1,2), plot(t(1:128),x2(1:128)) title('sample length of modulation wave'); 4

soundsc(x2) Create the AM signal, s %%% Amplitude modulate the carrier s = ((1 + x2).*x1); subplot(3,1,3), plot(t(1:128),s(1:128)) title('sample length of modulated carrier wave'); soundsc(s) Add noise to AM signal %%% Add noise to the AM signal n = A(1:(1 + (fs * 4.0))); % truncate noise sequence sn = s + n; % add noise to signal subplot(3,1,3), plot(t(1:128),sn(1:128)) title('sample length of noisy AM wave'); soundsc(sn) Three graphs should be visible on the PC screen:- Carrier wave against time; Message signal against time; Noisy AM signal against time. Obtain a printout of these on a single sheet of A4. Attach this to your report Process the Noisy AM Signal (File: lab2_process.m) In this section you will retrieve the message signal from the noisy AM signal that you synthesised in the previous section. This will be achieved by a three stage process :- (i) Band-pass filter the carrier wave, (ii) Rectify the modulated carrier, (iii) Low-pass filter the rectified carrier to obtain the message signal. (i) Band-pass filter the carrier wave. Design a filter. The filter is specified in the frequency domain. Transform the AM signal and view its spectrum. %%% Transform a sample of the AM signal to the frequency domain S=fft(sn(1:1024)); %use fast Fourier transform, sample length 1024 Sa=abs(S); % modulus of spectrum Sp=angle(S); %phase % Calibrate spectrum in Hz b = 1:1024; frs = (b-1)/1024*fs; % frequencies % plot graph clf % clear screen subplot(3,1,1), plot(frs,sa); title('spectrum of AM wave'); ylabel(' Sa '); Observe the carrier and sidebands. You must design a filter to extract both the carrier and the sidebands. The gain will be [0 0 1 1 0 0]. Try significant frequencies [0 350 440 560 650 fs/2] Hz. %%% Tune in the carrier. That is band pass filter the AM signal 5

%design the filter fhz = [0 350 440 560 650 fs/2]; mbp = [0 0 1 1 0 0]; f0 = fhz/(fs/2); b_bp = remez(120, f0, mbp); %specify significant frequencies %magnitude specification of band-pass %non-dimensional significant frequencies % obtain filter coefficients %check the pass and stop bands of the filter fhz1 = linspace(0, fs/2, 50); om1 = 2*pi*fHz1; z = exp(sqrt(-1)*om1/fs); bp = abs(polyval(b_bp,z)); subplot(3,1,2), plot(fhz1,bp) title('band-pass filter characteristic'); Now tune in the noisy AM signal % filter the noisy AM signal am = filter(b_bp,1,sn); AM = abs(fft(am(1:1024))); % Check the spectrum of the filtered AM signal subplot(3,1,3), plot(frs,am); title('spectrum of tuned AM wave'); ylabel(' Sa '); xlabel('frequency (Hz)'); Attach a printout of these three frequency domain plots to your report. Now you can detect the message signal. Firstly rectify the AM wave. %%% Retrieve the message signal (80 Hz sinusoid) % View a sample of the tuned (received) AM signal clf subplot(3,1,1), plot(t(1:400),am(1:400)) title('received AM signal'); soundsc(am); % Rectify the AM signal rec = am; % copy the am to rec for i = 1:(fs*4.0), if am(i) < 0; rec(i) = 0; % reset all negative samples to 0 end end subplot(3,1,2), plot(t(1:400),rec(1:400)) title('rectified AM signal'); soundsc(rec); The rectified signal must now be low-pass filtered. Specify and implement such a filter, and then use it to recover the message signal. Specification of the low-pass filter. 6

Frequency specification Vector (Hz): [ ] Non-dimensional frequency specification vector: [ ] Gain specification vector: [ ] Filter order: Comment on the suitability of this filter: Display the following three graphs on the PC screen:- Received AM signal against time; Rectified signal against time; Detected (low-pass filtered) signal against time. Obtain a printout of these on a single sheet of A4. Attach this to your report. Comment on the appearance of the message signal. Investigate the Noisy Signals (File: lab2_snr.m) Signal to Noise Ratio (SNR). We can define the receiver input SNR as the ratio of the average power of the modulated input signal, P s to the average power of the input noise P n. Ps SNR = 10log. Pn Estimate the SNR of the noisy AM signal. In this case there are two ways to proceed. Firstly, P s and P n can be estimated before they are added (not generally the case). Secondly they can be estimated from measurements on the noisy AM signal. Estimation before P s and P n are added. Obtain statistics on s(t) and n(t). You need to calculate the average power of each signal, ie sum the squares of the individual samples and divide by N, the number of samples. eg: 1 N 2 P = ( n k ). n k = 1 [] N Basically you are calculating the mean square value, and noting that the mean value of each signal is zero, you can use the variance (var) function to calculate the average power of each signal. %%% Estimate SNR before addition of am signal and noise % Estimate noise power MEAN = mean(n) MAX = max(n) MIN = min(n) VARIANCE = var(n) Pn = VARIANCE; 7

subplot(3,1,1), plot(t(1:400),n(1:400)) title('sample of noise signal'); n_sq = n.* n; subplot(3,1,2), plot(t(1:400),n_sq(1:400)) title('sample of noise power'); ylabel('power (V**2)'); % Estimate signal power MEAN = mean(s) MAX = max(s) MIN = min(s) VARIANCE = var(s) Ps = VARIANCE; s_sq = s.* s; subplot(3,1,3), plot(t(1:400),s_sq(1:400)) title('sample of signal power'); ylabel('power (V**2)'); SNR = 10 * log10(ps/pn) %use log10 for base 10 Record the statistics and SNR of the separate signals Mean Maximum Minimum Variance (power) Signal s(t) Noise n(t) SNR db Estimate the SNR from the received AM wave. You will have to extract the noise and AM signals from the received signal. Use filters. You already have the band-pass filtered am wave. Try bandstop filtering with the inverse characteristic to obtain the noise. Then proceed as above. Record the statistics and SNR of the combined AM wave Mean Maximum Minimum Variance (power) Signal s(t) Noise n(t) SNR db Comment on the difference between the SNR when estimated by these two methods. RCS, 7/10/04 8

3. PART (B): MATCHED FILTER. 3.1 The Problem. A diver suspects there are some sharks nearby. The diver has a sonar echo transmitter/receiver device and transmits a sonar pulse in the direction of the sharks. The received pulses are buried in additive noise, but can be detected using a matched filter. Your task is to design an appropriate matched filter. The diver wants the information immediately, but you have until the assignment deadline. 3.2 Statistical Analysis of the Entire Noisy Signal. The discrete noisy signal is available from the Postgraduate MSc website together with an electronic version of this document. This should be downloaded to your computer. The computer you use must have Matlab loaded. Save the signal into a file and then read it into Matlab using commands such as:- fid = fopen( noisy_signal.txt, r ); [A,Flength] = fscanf(fid, %f,[1,inf]; Use Matlab commands (max, min, mean, std) to find the maximum, minimum, mean and standard deviation of the signal. Plot the signal, a histogram of the signal, its autocorrelation function (see xcorr), and the FFT of the signal. Comment on each of these and include them in your report. 3.3 Calculation of the replica sonar pulse sequence The pulse consists of a single sinusoid ( s(t) = sin(2πft)) that is windowed in the time domain by a triangular envelope. The window length is 512 samples and the period of the sinusoid is 32 samples. The envelope has four straight sides, a b c d. Line a goes from (0,0.0) to (170,1.0), b goes from (170,1.0) to (512,0.0), c goes from (0,0.0) to (170,-1.0), and d goes from (170,-1.0) to (512,0.0). Use 9

the sin function and the envelope parameters to create a replica sequence. Then plot it. The plot should appear as in the above figure, but without the envelope lines. 3.4 Calculation of FIR filter weights Calculate the FIR filter weights from the replica signal. Plot the value of these as points marked x against sample number. 3.5 Detect the sonar pulses Match filter the noisy sonar data (eg use conv). Plot the output sequence. Threshold the output sequence (try a threshold level = 0.6*max(output)). Plot the thresholded output. 3.6 How far away are the sharks? Given a sampling period of 0.05ms, and the velocity of sound in water of 1497 ms -1, estimate the distance of each shark from the diver. Which shark is the biggest? RCS/ 11/10/2004 10