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

Similar documents
The Formula for Sinusoidal Signals

DFT: Discrete Fourier Transform & Linear Signal Processing

Physics 115 Lecture 13. Fourier Analysis February 22, 2018

Problem Set 1 (Solutions are due Mon )

LAB 2 SPECTRUM ANALYSIS OF PERIODIC SIGNALS

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

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

Signal Processing First Lab 20: Extracting Frequencies of Musical Tones

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

Electrical & Computer Engineering Technology

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

Fourier Series and Gibbs Phenomenon

Biomedical Signals. Signals and Images in Medicine Dr Nabeel Anwar

1 Introduction and Overview

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

Lecture 3 Complex Exponential Signals

CHAPTER 4 IMPLEMENTATION OF ADALINE IN MATLAB

Fourier Signal Analysis

ME 365 EXPERIMENT 8 FREQUENCY ANALYSIS

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

EE 422G - Signals and Systems Laboratory

GEORGIA INSTITUTE OF TECHNOLOGY. SCHOOL of ELECTRICAL and COMPUTER ENGINEERING

Fourier Transform. Prepared by :Eng. Abdo Z Salah

Real Analog - Circuits 1 Chapter 11: Lab Projects

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

Basic Signals and Systems

SECTION 7: FREQUENCY DOMAIN ANALYSIS. MAE 3401 Modeling and Simulation

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

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

ELT COMMUNICATION THEORY

Log Booklet for EE2 Experiments

Additive Synthesis OBJECTIVES BACKGROUND

EXPERIMENT 4 INTRODUCTION TO AMPLITUDE MODULATION SUBMITTED BY

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

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

Discrete Fourier Transform (DFT)

Laboratory Assignment 4. Fourier Sound Synthesis

George Mason University Signals and Systems I Spring 2016

ECE 2026 Summer 2016 Lab #08: Detecting DTMF Signals

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

UNIVERSITY OF UTAH ELECTRICAL AND COMPUTER ENGINEERING DEPARTMENT

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

Digital Signal Processing Laboratory 1: Discrete Time Signals with MATLAB

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

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

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

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

Lab 4 Fourier Series and the Gibbs Phenomenon

EE Experiment 8 Bode Plots of Frequency Response

1 Introduction and Overview

ELEC3104: Digital Signal Processing Session 1, 2013

LABORATORY - FREQUENCY ANALYSIS OF DISCRETE-TIME SIGNALS

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

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

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

Sound synthesis with Pure Data

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

ECE411 - Laboratory Exercise #1

Lab 0: Introduction to TIMS AND MATLAB

School of Engineering and Information Technology ASSESSMENT COVER SHEET

DSP First. Laboratory Exercise #7. Everyday Sinusoidal Signals

Lab 8: Frequency Response and Filtering

Octave Functions for Filters. Young Won Lim 2/19/18

Analog Filter Design. Part. 2: Scipy (Python) Signals Tools. P. Bruschi - Analog Filter Design 1

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

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

Lecture 3, Multirate Signal Processing

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

ECE 5650/4650 MATLAB Project 1

Digital Signal Processing ETI

SGN Bachelor s Laboratory Course in Signal Processing Audio frequency band division filter ( ) Name: Student number:

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

Advanced Audiovisual Processing Expected Background

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

EE 5410 Signal Processing

Experiment 1 Introduction to MATLAB and Simulink

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

Lab 3 FFT based Spectrum Analyzer

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

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

1 ONE- and TWO-DIMENSIONAL HARMONIC OSCIL- LATIONS

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

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

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

ENGR 210 Lab 12: Sampling and Aliasing

EEE - 321: Signals and Systems Lab Assignment 3

Digital Signal Processing ETI

ECE 201: Introduction to Signal Analysis. Dr. B.-P. Paris Dept. Electrical and Comp. Engineering George Mason University

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

ECE 201: Introduction to Signal Analysis

Design a DAC sinx/x Corrector

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

The Discrete Fourier Transform. Claudia Feregrino-Uribe, Alicia Morales-Reyes Original material: Dr. René Cumplido

Discrete Fourier Transform

George Mason University ECE 201: Introduction to Signal Analysis

E40M Sound and Music. M. Horowitz, J. Plummer, R. Howe 1

Lab 6: Sampling, Convolution, and FIR Filtering

ECEGR Lab #8: Introduction to Simulink

EE 215 Semester Project SPECTRAL ANALYSIS USING FOURIER TRANSFORM

Digital Signal Processing

Transcription:

THE HONG KONG POLYTECHNIC UNIVERSITY Department of Electronic and Information Engineering EIE2106 Signal and System Analysis Lab 2 Fourier series 1. Objective The goal of this laboratory exercise is to explore the implementation of various fundamental concepts in Fourier analysis using MATLAB. The lab is divided into two parts: (i) Sinusoids and (ii) Fourier series. 2. Preparation A PC with Microsoft Windows 7 SP1, 8 or 8.1 MATLAB 2009b A headphone 3. Sinusoids Sinusoidal signals, or more concisely, sinusoids, are the most basic signals in signal processing. It can be represented mathematically by the following formulation: where A is the amplitude of the sinusoid; f is the frequency and is the phase delay. By using MATLAB, we can visualize a sinusoid. For example, the following statements let us display a sinusoid with A = 2, f =1000Hz and = /2. A=2; f0 = 1000; phi = pi/2; T0 = 1/f0; tt = 0 : T0/40 : 4*T0; xx = A*cos(2*pi*f0*tt + phi); plot(tt,xx) axis([0,0.004,-4,4]) and y axes xlabel('time (sec)'); grid on grid % Define the values the three parameters % Define the sampling points % Generate the cosine function % Plot the cosine function % Adjust maximum and minimum of x % Add a label to x axis % Show the cosine function on a 3.1 Try the program above by putting it into a M file. Show the result waveform. 3.2 Modify the program such that it would only show 3 cycles of the sinusoid. Show your program. 3.3 Design a function namely, sinwave(a,f,phi), such that it will show a sinusoid of amplitude A, frequency F and phase delay Phi. Note that no matter what the values of A, F,

Phi are, your program should be able to display only 3 cycles of the sinusoid. Show your program. 4. Fourier Series Fourier first shows that any periodic waveform can be synthesized by a sum of sinusoids that are harmonically related. To be specific, any continuous time periodic waveform can be represented by the Fourier series as follows: Or it can be written as follows: where are the Fourier series coefficients. For example, we can synthesize a square wave by using some harmonics of sinusoids. Let be a square wave as defined as follows: We know that it can be represented by Fourier series with the following coefficients To visualize how a square wave can be constructed by the summation of sinusoids, we can again make use of the MATLAB. The following program let us add together the first, 3 rd, 5 th and 7 th harmonics of a sinusoid with amplitude as defined above. You can see a waveform that is similar to a square wave is shown. A=2; f0 = 1000; phi = -pi/2; T0 = 1/f0;

tt = 0 : T0/400 : 4*T0; % All cosine functions are summed here xx = (4*A/pi/1)*cos(2*pi*f0*tt + phi)+... (4*A/pi/3)*cos(2*pi*3*f0*tt + phi)+... (4*A/pi/5)*cos(2*pi*5*f0*tt + phi)+... (4*A/pi/7)*cos(2*pi*7*f0*tt + phi); plot(tt,xx) axis([0,0.004,-4,4]) xlabel('time (sec)'); grid on 4.1 Try the program above by putting it into a M file. Show the result waveform 4.2 Design a function namely, squarewave(n), such that it will display a square wave constructed by the summation of N odd harmonics of a sinusoid. Show your program and the resulting waveform when N = 1, 2, 10, and 100. 4.3 Why we cannot achieve a perfect square wave when N = 100? 5. Tone generation Different tones can be generated by using sine wave. To generate a tone using sine wave, we may type the following according to the frequency we set. fs=8192; t=[0:1/fs:1]; y = sin(2*pi*freq*t); soundsc(y) 5.1 Consider setting freq to be 440*2^(1/12), what sound is that? 5.2 Consider the following different settings of frequencies, what sounds do they represent? 440*2^(n/12) where n is [3,5,6,7,10,12,13] 5.3 can you compose a simple song using the above note? Demonstrate your song before the end of the lab session.

6. References [1] T.A. Driscoll, Learning MATLAB, Philadelphia, PA : Society for Industrial and Applied Mathematics, c2009. [2] Using MATLAB, The Math Works Inc. Appendix : The Function of MATLAB A. General help [instruction] Displays help for [instruction] help Displays a list of available instructions dir ( or ls) Lists directory cd Change directory who (whos) Lists current variables format Set output (display) format, e.g. format compact ; (after command) Suppresses the display of result B. Matrix Row matrix : A = [1,2,3] or A = [1 2 3] Column matrix: A = [1:1:3] or A = [1, 2, 3] Rectangular matrix: A = [1 2 3 4: 5 6 7 8] To access an element: c = [A (row, column )]; e.g. A(2,3) To access an row: c = [A (row,:)]; e.g. A(1,:) = the first row of A To access an column: c = [A (:,column)]; Identity matrix: b = eye (n), where n is an integer Ones matrix: x = ones(m,n) Zeros matrix: y = zeros(m,n) length(x) Shows the length of vector x size(a) Shows the size of matrix A in (row, column) C. Special Variable and Constants Ans Most recent answer eps Floating point relative accuracy i, j Imaginary unit; e.g. c = 2 + 5i inf Infinity pi Nan Not a number D. Control Flow if {condition} else end

if {condition} elseif {condition} else end for j = 1:N end while {condition} end E. Mathematical Operators + Plus + Unary plus Minus Unary minus * Matrix multiply.* Element by element multiply \ Backslash or left matrix divide / Slash or right matrix divide.\ Left array divide./ Right array divide ^ power.^ Array power F. Functions abs Absolute value angle Phase angle cos cosine sin sine imag Complex imaginary part real Complex real part G. Useful Functions y = fft (x) or y = fft(x, n) FFT of x ; n is number of point [z, p, k] = buttap(n) butterworth analog prototype [num, den] = zp2tf (z, p, k) zero pole to transfer function [bz, az] = impinvar (num, den, fs) impulse invariant transformation [zd, pd, kd] = bilinear (z, p, k, fs ) bilinear transformation [h,w] = freqz (num, den, n) Z transform digital filter frequency response w = hamming (n) hamming window stem plot the signal in the impulse form