Digital Signal Processing

Similar documents
Discrete Fourier Transform (DFT)

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

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

LABORATORY - FREQUENCY ANALYSIS OF DISCRETE-TIME SIGNALS

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

Log Booklet for EE2 Experiments

ELT COMMUNICATION THEORY

DFT: Discrete Fourier Transform & Linear Signal Processing

Problem Set 1 (Solutions are due Mon )

Making 2D Plots in Matlab

Chapter 5 Window Functions. periodic with a period of N (number of samples). This is observed in table (3.1).

Frequency Domain Representation of Signals

SIGNALS AND SYSTEMS LABORATORY 3: Construction of Signals in MATLAB

EE 215 Semester Project SPECTRAL ANALYSIS USING FOURIER TRANSFORM

From Fourier Series to Analysis of Non-stationary Signals - VII

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

Distortion Analysis T S. 2 N for all k not defined above. THEOREM?: If N P is an integer and x(t) is band limited to f MAX, then

Integrators, differentiators, and simple filters

Fourier Signal Analysis

INTRODUCTION TO MATLAB by. Introduction to Matlab

ELEC3104: Digital Signal Processing Session 1, 2013

Noise Measurements Using a Teledyne LeCroy Oscilloscope

Electrical & Computer Engineering Technology

Signal Processing. Introduction

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

Experiment 1 Introduction to MATLAB and Simulink

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

Laboratory Assignment 4. Fourier Sound Synthesis

9.1. Probability and Statistics

DESIGN OF A SIMPLE RELIABLE VOTER FOR MODULAR REDUNDANCY IMPLEMENTATIONS

Assignment 6: Solution to MATLAB code for BER generation of QPSK system over AWGN channel.

CSCD 409 Scientific Programming. Module 6: Plotting (Chpt 5)

EE 422G - Signals and Systems Laboratory

EE 464 Short-Time Fourier Transform Fall and Spectrogram. Many signals of importance have spectral content that

Discrete Fourier Transform, DFT Input: N time samples

Operational Amplifier Circuits

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

ENSC327 Communication Systems Fall 2011 Assignment #1 Due Wednesday, Sept. 28, 4:00 pm

EE 435. Lecture 34. Spectral Performance Windowing Quantization Noise

Biomedical Signals. Signals and Images in Medicine Dr Nabeel Anwar

Lab #2 First Order RC Circuits Week of 27 January 2015

Use Matlab Function pwelch to Find Power Spectral Density or Do It Yourself

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

ECE 5650/4650 MATLAB Project 1

Sound synthesis with Pure Data

EXPERIMENT 4 INTRODUCTION TO AMPLITUDE MODULATION SUBMITTED BY

ECEGR Lab #8: Introduction to Simulink

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

Real Analog - Circuits 1 Chapter 11: Lab Projects

Lab 0: Introduction to TIMS AND MATLAB

EECS 452 Midterm Exam (solns) Fall 2012

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

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

Fourier Methods of Spectral Estimation

Chapter Three. The Discrete Fourier Transform

Computer Programming ECIV 2303 Chapter 5 Two-Dimensional Plots Instructor: Dr. Talal Skaik Islamic University of Gaza Faculty of Engineering

UNIVERSITY OF WARWICK

UNIVERSITY OF WARWICK

George Mason University Signals and Systems I Spring 2016

Massachusetts Institute of Technology Department of Electrical Engineering and Computer Science Circuits & Electronics Spring 2005

######################################################################

4 Experiment 4: DC Motor Voltage to Speed Transfer Function Estimation by Step Response and Frequency Response (Part 2)

Contents. An introduction to MATLAB for new and advanced users

EE 435/535: Error Correcting Codes Project 1, Fall 2009: Extended Hamming Code. 1 Introduction. 2 Extended Hamming Code: Encoding. 1.

Time-Frequency analysis of biophysical time series

Digital Signal Processing Fourier Analysis of Continuous-Time Signals with the Discrete Fourier Transform

Laboratory Experiment #1 Introduction to Spectral Analysis

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

FFT Analyzer. Gianfranco Miele, Ph.D

ENGR 210 Lab 12: Sampling and Aliasing

Discrete Fourier Transform

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

6 Sampling. Sampling. The principles of sampling, especially the benefits of coherent sampling

REAL-TIME PROCESSING ALGORITHMS

Signal Processing First Lab 20: Extracting Frequencies of Musical Tones

HCS / ACN 6389 Speech Perception Lab

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

Introduction to Simulink

Reference Sources. Prelab. Proakis chapter 7.4.1, equations to as attached

Wireless Communication Systems Laboratory #2. Understanding test equipments. The students will be familiar with the following items:

Understanding Digital Signal Processing

UNIVERSITY OF UTAH ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT

Plotting in MATLAB. Trevor Spiteri

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

Time Series/Data Processing and Analysis (MATH 587/GEOP 505)

LAB 2 SPECTRUM ANALYSIS OF PERIODIC SIGNALS

C.8 Comb filters 462 APPENDIX C. LABORATORY EXERCISES

Swedish College of Engineering and Technology Rahim Yar Khan

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

Basic Signals and Systems

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

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

ME scope Application Note 02 Waveform Integration & Differentiation

Signal Processing Toolbox

APPENDIX A-5 THE CORRESPONDING FREQUENCY DOMAIN VALIDATION. APPENDIX A-5 shows plots for the corresponding time domain validation response

Advanced Lab LAB 6: Signal Acquisition & Spectrum Analysis Using VirtualBench DSA Equipment: Objectives:

Timbral Distortion in Inverse FFT Synthesis

The Fundamentals of Mixed Signal Testing

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

Armstrong Atlantic State University Engineering Studies MATLAB Marina Sound Processing Primer

Transcription:

Digital Signal Processing Lab 1: FFT, Spectral Leakage, Zero Padding Moslem Amiri, Václav Přenosil Embedded Systems Laboratory Faculty of Informatics, Masaryk University Brno, Czech Republic amiri@mail.muni.cz prenosil@fi.muni.cz Spring, 2015

Open MATLAB Create an m-file An m-file, or script file, is a simple text file where you can place MATLAB commands Choose New from the File menu and select Script Generate two separate 64 length buffers of the two sinusoids: Use a sampling frequency of 1 khz x 1 (t) = 100 sin(2π101.56t) x 2 (t) = 2 sin(2π156.25t) Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 2 / 29

y = 100*sin(2*pi*101.56*t); figure(1);plot(fs*t(1:50),y(1:50)); title( Signal ); xlabel( time (milliseconds) ); Run the m-file Press F5 Or type filename at the MATLAB command window prompt Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 3 / 29

y = 2*sin(2*pi*156.25*t); figure(2);plot(fs*t(1:50),y(1:50)); title( Signal ); xlabel( time (milliseconds) ); Execute the commands Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 4 / 29

Evaluate the FFT of each of these signals using a rectangular window, and determine which frequency bins have the highest peaks Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 5 / 29

y = 100*sin(2*pi*101.56*t); Y = fft(y,l)/l; f = Fs/2*linspace(0,1,L/2+1); % Plot single-sided amplitude spectrum. figure(1);plot(f,2*abs(y(1:l/2+1))) Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 6 / 29

We should divide FFT magnitudes by N/2 for real inputs The division by L is done in Y = fft(y,l)/l; Multiplication by 2 is done in plot(f,2*abs(y(1:l/2+1))) Command y = linspace(a,b,n) Generates a row vector y of n points linearly spaced between and including a and b For n < 2, linspace returns b f = Fs/2*linspace(0,1,L/2+1); Frequency of index bins is mfs/n For L = 64, it must be Fs, i.e. one full interval in frequency domain, so for half of that (L/2+1), it is Fs/2 Execute the commands Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 7 / 29

y = 2*sin(2*pi*156.25*t); Y = fft(y,l)/l; f = Fs/2*linspace(0,1,L/2+1); figure(4);plot(f,2*abs(y(1:l/2+1))) Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 8 / 29

Repeat the FFT evaluations done previously, but using a 1024 point FFT Applying a 1024 point FFT to a 64 length data buffer has the effect of appending (1024-64) zeros to the end of the data, which increases the number of points at which the spectrum is evaluated Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 9 / 29

y = 100*sin(2*pi*101.56*t); Y = fft(y,1024)/l; f = Fs/2*linspace(0,1,1024/2+1); figure(1);plot(f,2*abs(y(1:1024/2+1))) Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 10 / 29

Y = fft(x,n) returns the n-point DFT fft(x) is equivalent to fft(x,n) where n is the size of X in the first nonsingleton dimension If the length of X is less than n, X is padded with trailing zeros to length n If the length of X is greater than n, the sequence X is truncated When X is a matrix, the length of the columns are adjusted in the same manner Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 11 / 29

y = 2*sin(2*pi*156.25*t); Y = fft(y,1024)/l; f = Fs/2*linspace(0,1,1024/2+1); figure(4);plot(f,2*abs(y(1:1024/2+1))) Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 12 / 29

The Hamming window is defined as: w(n) = 0.54 0.46 cos(2πn/n) for n = 0, 1, 2,..., N 1 Generate and plot the Hamming window Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 13 / 29

n = (0:63); w = 0.54-0.46 * cos(2 * pi * n / 64); plot(n,w); Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 14 / 29

Now repeat FFT evaluations (without and with zero padding), but applying first a Hamming window to the 64 length data buffers before evaluating the FFTs Observe the outputs of the FFTs Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 15 / 29

y = 100*sin(2*pi*101.56*t); w = 0.54-0.46 * cos(2 * pi * (0 : 63) / 64); win = y.* w; Y = fft(win,l)/l; f = Fs/2*linspace(0,1,L/2+1); figure(2);plot(f,2*abs(y(1:l/2+1))) Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 16 / 29

y = 100*sin(2*pi*101.56*t); w = 0.54-0.46 * cos(2 * pi * (0 : 63) / 64); win = y.* w; Y = fft(win,1024)/l; f = Fs/2*linspace(0,1,1024/2+1); figure(3);plot(f,2*abs(y(1:1024/2+1))) Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 17 / 29

y = 2*sin(2*pi*156.25*t); w = 0.54-0.46 * cos(2 * pi * (0 : 63) / 64); win = y.* w; Y = fft(win,l)/l; f = Fs/2*linspace(0,1,L/2+1); figure(1);plot(f,2*abs(y(1:l/2+1))) Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 18 / 29

y = 2*sin(2*pi*156.25*t); w = 0.54-0.46 * cos(2 * pi * (0 : 63) / 64); win = y.* w; Y = fft(win,1024)/l; f = Fs/2*linspace(0,1,1024/2+1); figure(1);plot(f,2*abs(y(1:1024/2+1))) Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 19 / 29

Now add these two sine waves together, and apply both 64-length and 1024-length FFTs, with both rectangular and Hamming windows Observe how spectral leakage can mask a small signal in a large one Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 20 / 29

y = 100*sin(2*pi*101.56*t) + 2*sin(2*pi*156.25*t); Y = fft(y,l)/l; f = Fs/2*linspace(0,1,L/2+1); figure(2);plot(f,2*abs(y(1:l/2+1))) Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 21 / 29

y = 100*sin(2*pi*101.56*t) + 2*sin(2*pi*156.25*t); w = 0.54-0.46 * cos(2 * pi * (0 : 63) / 64); win = y.* w; Y = fft(win,l)/l; f = Fs/2*linspace(0,1,L/2+1); figure(2);plot(f,2*abs(y(1:l/2+1))) Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 22 / 29

y = 100*sin(2*pi*101.56*t) + 2*sin(2*pi*156.25*t); Y = fft(y,1024)/l; f = Fs/2*linspace(0,1,1024/2+1); figure(1);plot(f,2*abs(y(1:1024/2+1))) Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 23 / 29

y = 100*sin(2*pi*101.56*t) + 2*sin(2*pi*156.25*t); w = 0.54-0.46 * cos(2 * pi * (0 : 63) / 64); win = y.* w; Y = fft(win,1024)/l; f = Fs/2*linspace(0,1,1024/2+1); figure(3);plot(f,2*abs(y(1:1024/2+1))) Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 24 / 29

Now add Gaussian noise to the combined signals, with a variance of 10 Compare the results of evaluating the 1024 point FFT on a 64-length data buffer (i.e. with zero padding), with a 1024 point FFT applied to a 1024-length data buffer (i.e. generate more data) In MATLAB, to generate the noise, try: noise = sqrt (variance) * randn(); Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 25 / 29

x = 100*sin(2*pi*101.56*t) + 2*sin(2*pi*156.25*t); y = x + sqrt(10)*randn(size(t)); % Sinusoids plus noise Y = fft(y,1024)/l; f = Fs/2*linspace(0,1,1024/2+1); figure(1);plot(f,2*abs(y(1:1024/2+1))) Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 26 / 29

L = 1024; x = 100*sin(2*pi*101.56*t) + 2*sin(2*pi*156.25*t); y = x + sqrt(10)*randn(size(t)); % Sinusoids plus noise Y = fft(y,1024)/l; f = Fs/2*linspace(0,1,1024/2+1); figure(2);plot(f,2*abs(y(1:1024/2+1))) Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 27 / 29

Logarithmic axis scaling Log-log and semi-log plots are created with commands that act just like the plot command Command Name: loglog, Plot type: log(y) versus log(x) Command Name: semilogx, Plot type: y versus log(x) Command Name: semilogy, Plot type: log(y) versus x Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 28 / 29

L = 1024; x = 100*sin(2*pi*101.56*t) + 2*sin(2*pi*156.25*t); y = x + sqrt(10)*randn(size(t)); % Sinusoids plus noise Y = fft(y,1024)/l; f = Fs/2*linspace(0,1,1024/2+1); figure(2);semilogy(f,2*abs(y(1:1024/2+1))) Moslem Amiri, Václav Přenosil Digital Signal Processing Spring, 2015 29 / 29