Digital Signal Processing Laboratory 1: Discrete Time Signals with MATLAB

Similar documents
Figure 1: Block diagram of 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

Problem Set 1 (Solutions are due Mon )

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

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

Laboratory Assignment 2 Signal Sampling, Manipulation, and Playback

Lab 4 Fourier Series and the Gibbs Phenomenon

Basic Signals and Systems

Fourier Series and Gibbs Phenomenon

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

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

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

LABORATORY - FREQUENCY ANALYSIS OF DISCRETE-TIME SIGNALS

SIGNALS AND SYSTEMS LABORATORY 3: Construction of Signals in MATLAB

Electrical & Computer Engineering Technology

Additive Synthesis OBJECTIVES BACKGROUND

Sampling and Reconstruction of Analog Signals

DSP First. Laboratory Exercise #7. Everyday Sinusoidal Signals

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

Matlab for CS6320 Beginners

STANFORD UNIVERSITY. DEPARTMENT of ELECTRICAL ENGINEERING. EE 102B Spring 2013 Lab #05: Generating DTMF Signals

ECE 5650/4650 MATLAB Project 1

UNIVERSITY OF UTAH ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT

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

Lecture 7 Frequency Modulation

Complex Numbers in Electronics

ELT COMMUNICATION THEORY

Armstrong Atlantic State University Engineering Studies MATLAB Marina Sound Processing Primer

LAB 4 GENERATION OF ASK MODULATION SIGNAL

Introduction to Simulink Assignment Companion Document

Experiments #6. Convolution and Linear Time Invariant Systems

Signal Processing. Introduction

George Mason University Signals and Systems I Spring 2016

1. page xviii, line 23:... conventional. Part of the reason for this...

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

EGR 111 Audio Processing

EE 215 Semester Project SPECTRAL ANALYSIS USING FOURIER TRANSFORM

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

Experiment 8: Sampling

Spectrum Analysis: The FFT Display

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

George Mason University ECE 201: Introduction to Signal Analysis Spring 2017

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

EE 5410 Signal Processing

Laboratory Assignment 4. Fourier Sound Synthesis

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

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

Lab 3 FFT based Spectrum Analyzer

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

Experiment 1 Introduction to MATLAB and Simulink

SIGNALS AND SYSTEMS: 3C1 LABORATORY 1. 1 Dr. David Corrigan Electronic and Electrical Engineering Dept.

Lab 6: Sampling, Convolution, and FIR Filtering

1 Introduction and Overview

CMPT 318: Lecture 4 Fundamentals of Digital Audio, Discrete-Time Signals

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

Biomedical Signals. Signals and Images in Medicine Dr Nabeel Anwar

The Formula for Sinusoidal Signals

Continuous vs. Discrete signals. Sampling. Analog to Digital Conversion. CMPT 368: Lecture 4 Fundamentals of Digital Audio, Discrete-Time Signals

Signal Processing First Lab 20: Extracting Frequencies of Musical Tones

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

EXPERIMENT 4 INTRODUCTION TO AMPLITUDE MODULATION SUBMITTED BY

DFT: Discrete Fourier Transform & Linear Signal Processing

EE482: Digital Signal Processing Applications

Introduction. A Simple Example. 3. fo = 4; %frequency of the sine wave. 4. Fs = 100; %sampling rate. 5. Ts = 1/Fs; %sampling time interval

Digital Signal Processing ETI

Digital Signal Processing ETI

1 Introduction and Overview

C.8 Comb filters 462 APPENDIX C. LABORATORY EXERCISES

ECE411 - Laboratory Exercise #1

ECE 3500: Fundamentals of Signals and Systems (Fall 2014) Lab 4: Binary Phase-Shift Keying Modulation and Demodulation

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

ECE 2713 Homework 7 DUE: 05/1/2018, 11:59 PM

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

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

Islamic University of Gaza. Faculty of Engineering Electrical Engineering Department Spring-2011

Project I: Phase Tracking and Baud Timing Correction Systems

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

Experiment # 4. Frequency Modulation

ECE 3500: Fundamentals of Signals and Systems (Fall 2015) Lab 4: Binary Phase-Shift Keying Modulation and Demodulation

Lecture 2: SIGNALS. 1 st semester By: Elham Sunbu

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

Class #16: Experiment Matlab and Data Analysis

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

Waveshaping Synthesis. Indexing. Waveshaper. CMPT 468: Waveshaping Synthesis

DSP First. Laboratory Exercise #4. AM and FM Sinusoidal Signals

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

Brief Introduction to Signals & Systems. Phani Chavali

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

FACULTY OF ENGINEERING LAB SHEET ETN3046 ANALOG AND DIGITAL COMMUNICATIONS TRIMESTER 1 (2018/2019) ADC2 Digital Carrier Modulation

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

Faculty of Engineering Electrical Engineering Department Communication Engineering I Lab (EELE 3170) Eng. Adam M. Hammad

Lab 8. Signal Analysis Using Matlab Simulink

University of Bahrain

Modelling and Simulation of a DC Motor Drive

Introduction to DSP ECE-S352 Fall Quarter 2000 Matlab Project 1

Laboration Exercises in Digital Signal Processing

EE 422G - Signals and Systems Laboratory

George Mason University ECE 201: Introduction to Signal Analysis

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

ME 365 EXPERIMENT 8 FREQUENCY ANALYSIS

Transcription:

Digital Signal Processing Laboratory 1: Discrete Time Signals with MATLAB Thursday, 23 September 2010 No PreLab is Required Objective: In this laboratory you will review the basics of MATLAB as a tool for computation and visualization by using it to create sampled signals. You will learn the units for and relationships between sampling intervals, sampling frequency, number of samples observed, total time observed, signal frequency, and normalized frequency. Background notes: A continuous signal defined mathematically can be "sampled" by simply evaluating it at integer multiples of a sampling interval, T. The corresponding sampling frequency is F T = 1/T. If T is the sampling interval in seconds per sample, then F T is the sampling frequency in Hertz ( i.e. samples per second). An analog sinusoidal signal with frequency f 0 in Hertz (ie cycles per second) is given by x a (t) = A cos(2πf 0 t + φ). The discrete time representation is given by x[n] = A cos(2πf 0 (nt)+ φ ) = A cos(2π(f 0 T)n+ φ ) = A cos(2π(f 0 /F T )n+ φ ) = A cos(2π(ν )n+ φ ) where ν= (f 0 /F T ) cycles per sample. For sinusoidal signals we will often use the normalized frequency, ν. If f 0 cycles per second is the actual frequency of the sinusoid to be sampled, the normalized frequency, ν, is the ratio of the actual frequency to the sampling frequency, ν =f 0 /F T. Unit analysis shows that the units of the normalized frequency are ( cycles per second)/(samples/second) = cycles per sample. The value of the normalized frequency, ν, should be less than 0.5 for accurate representation of the continuous sinusoidal signal by the discrete time sampled signal. MATLAB can be used to easily create and display discrete time signals. There are several ways to generate MATLAB statements to be executed. MATLAB can be used interactively, like a calculator. Type statements in response to the >> prompt and see the result of the statement immediately after it is typed. The arrow keys allow previous statements to be executed again or edited. However, this can be tedious if many statements need to be repeated.

An m-file can be a MATLAB script that contains a list of statements. The m-file is executed by simply typing the file name in response to the prompt in the interactive mode. This has the same effect as typing all the individual m-file statements in the interactive mode. Used in this way, the m-file is not a function. The statements in the m-file have access to variables in the workspace that were defined before the m-file is used. After the m-file instructions are complete, the interactive instructions that follow it in the command window or other m-files have access to all data created by the m-file instructions. This laboratory has four parts. Follow the instructions for each part and create the files and plots as required. Laboratory - Part 1 - Interactive creation of vectors and plots MATLAB represents a discrete time signal as an array or vector. Many operations are available for point by point operations on a vector so that explicit "for loops" are rarely needed. Start MATLAB on your workstation. Type the statements listed in the left column of the table below and observe the responses. Then answer the associated questions. Note that semicolons are not placed at the end of these statements, so the result of each statement will be displayed in the command window. This is sometimes useful for short vectors, but should be avoided for larger data vectors. test1=0:6 test1(4) Statements to type Questions...Answers... How long is the vector test1? (Look in the workspace window or type "whos" in response to the >> prompt. Is element 4 of vector test1 equal to 4? Why or why not? powv=2.^test1 cosv=cos(2*pi*(1/6)*test1) expv1=exp(2*pi*(1/6)*test1) Explain each of the four vectors created with these expv2=exp(2*pi*j*(1/6)*test1) four statements. How is expv1 different from expv2? It is easier to see the structure of a signal from a plot than from reading the list of numerical values. plot(expv1) What does this plot show? What is the horizontal axis?

plot(expv2) plot( test1, real(expv2), test1, imag(expv2) ) What does this plot show? Explain it in terms of the values displayed when it was created. How is this plot different from the previous one? How is this horizontal axis different from the axis for the plot of expv1? Laboratory - Part 2 - Sampled Sinusoids Interactive Mode statements: 1. Type these statements and observe the plots in the Figure window. (Note the semicolons at the end of each statement!!) Type "help plot" to find more information about plotting. Both plots are plotting the same set of sampled values with linear interpolation between the samples. Verify that the titles and scaling of each are correct. N1=2000; freq1=0.02; phase=0.0; svec1=0:n1; sig1=cos(2*pi*freq1*svec1+phase); whos subplot(2,1,1) plot(svec1,sig1) xlabel('sample number') title([ 'cosine at normalized frequency = ' num2str(freq1)... ' cycles/sample']) The... allows a statement to be continued on the next line subplot(2,1,2) Ts=.005; sample interval plot(svec1*ts, sig1) xlabel('time in seconds') title([ 'Cosine at frequency = ' num2str(freq1/ts)...

' Hz with Ts = ' num2str(1000*ts) ' ms']) 2. The interactive statements above will be put into two m-files so they can be used many times without retyping them all. The Input statement will allow you to change the value of parameters. Using the MATLAB editor, create and save the following text as an m-file named getcossig.m. Note that this m-file is not a function. N1=input('Enter number of samples: '); freq1=input('enter normalized frequency in cycles/sample: '); phase=0.0; svec1=0:(n1-1); sig1=cos(2*pi*freq1*svec1+phase); 3. Using the MATLAB editor, create and save the following text as an m-file named plotcossig.m. subplot(2,1,1) plot(svec1,sig1) xlabel('sample number') title([ 'cosine at normalized frequency = ' num2str(freq1) ' cycles/sample']) subplot(2,1,2) Ts=input('Enter sample time interval in seconds: ') plot(svec1*ts, sig1) xlabel('time in seconds') title([ 'Cosine at frequency = ' num2str(freq1/ts)... ' Hz with Ts = ' num2str(1000*ts) ' ms']) 4. Using the two mfiles, do the following. Reproduce the plots from step 1. How many statements do you need to type in the interactive mode? If you get error messages on the screen from either m-file, edit the m-file to correct the error and then run it again. After you have successfully reproduced the results from step 1, use the two m-files to make plots of the signals specified below. In each case answer the following questions: What is the sampling frequency? How many samples are there per cycle of the input signal? What is the time duration of one cycle on your plot? o For N1=1000, find the correct parameters to plot 10 seconds of a 2.5 Hz signal. o For Ts=0.002, find the correct parameters to plot 5 seconds of a 1.2 Hz signal. o o For f=0.1, find the correct parameters to plot 0.4 seconds of a 5 Hz signal. For N1=20, find the correct parameters to plot 0.4 seconds of a 55 Hz signal. Does this plot match its labels? Why or why not?

Laboratory - Part 3 - Sound Output Using getcossig, create sig1 with N1=8000 and ν =0.0625. Type help sound to learn how to make sound output. Listen to the output sound using sound(sig1,8000). Estimate the duration of the tone and a relative frequency. Is this consistent with F T = 8000Hz? Listen to the output sound using sound(sig1,4000). Compare the duration and frequency to the previous sound output. Is this consistent with F T = 4000Hz? Explain. Listen to the output sound using sound(sig1,12000). Compare the duration and frequency to the previous sound output. Is this consistent with F T = 12000Hz? Explain. What is the relationship of ν to the actual frequency of the tone you hear? How can the same sequence of data points make different frequency sounds? Listen to the output sound using sound(0.5*sig1,8000). Compare it to the first sound output you created. What is different? Why? Listen to the output sound using sound(5.0*sig1,8000). Compare it to the first sound output you created. What is different? Why? (You may want to reread the information about the sound function.) Laboratory - Part 4 Two Simple Filters Write an short m-file named myfilter3 that will implement a three coefficient weighted average filter as follows: Assume that x_in and b_coef vectors are already created before you use myfilter3, and that b_coef has only 3 values. Explicitly create delayed input vectors: x_n = [ x_in 0 0], x_nm1=[0 x_in 0 ], and x_nm2=[0 0 x_in ]. Create the filter output y_out = b_coef[1]* x_n + b_coef[2]*x_nm1 + b_coef[3]*x_nm2 Use your m-file to create the output for the coefficients and inputs specified below. Plot you re the input and output for each case. Set b_coef=[1/3 1/3 1/3] o Set x_in = [ zeros(1,10), ones(1, 20), zeros(1,10) ] o Set x_in = 0:39 o Set x_in = (-1).^(0:39) Set b_coef = [1/4-1/2 1/4]] o Set x_in = [ zeros(1,10), ones(1, 20), zeros(1,10) ] o Set x_in = 0:39 o Set x_in = (-1).^(0:39) Laboratory Report: For your laboratory report submit the answers to all questions in the laboratory procedure and submit the plots from Part 4.

(C) Sally Wood 2001-20010