ee2170 lab7 manual

5
Southern Methodist University School of Engineering Electrical Engineering Department EE 2170 Design and Analysis of Signals and Systems Laboratory Notes Yasser Ghanbari, Carlos Davila, Scott C. Douglas, and Panos E. Papamichalis, ©2011, SMU. All Rights Reserved Spring 2011

Upload: diana-diaz

Post on 30-Sep-2015

216 views

Category:

Documents


2 download

DESCRIPTION

1

TRANSCRIPT

  • Southern Methodist University

    School of Engineering

    Electrical Engineering Department

    EE 2170 Design and Analysis of Signals and Systems

    Laboratory Notes

    Yasser Ghanbari, Carlos Davila, Scott C. Douglas, and Panos E.

    Papamichalis,

    2011, SMU. All Rights Reserved

    Spring 2011

  • Contents

    4. Integral in MATLAB

    a. Example: integration in MATLAB

    b. Example: convolution of two signals using trapz

    c. Example: convolution of two signals using conv

    d. Assignment 4: Convolution

    5. Exponential Fourier Series

    a. Exponential Fourier series coefficients

    b. Signal reconstruction using the exponential Fourier series coefficients

    c. Side note: summation of vectors

    d. Assignment 5: exponential Fourier series in MATLAB

    6. Introduction to Simulink

    a. Example: Fourier series coefficient in Simulink

    b. Example: square wave signal reconstruction in Simulink

    c. Assignment 6: exponential Fourier series coefficients in Simulink

    7. Fourier Transform

    a. Example: Fourier transform of a rectangular function

    b. Assignment 7: Fourier Transform

    8. First Order RC Lowpass Filters

    a. Example: frequency response of the first order LPF

    b. Assignment 8: RC Lowpass Filters

    9. Filters in LTI Systems

    a. Example: lowpass filtering of a noisy EKG signal

    b. Assignment 9: Lowpass, Highpass, and Bandstop Filters

    10. Audio Signals

    a. Example: audio signal analysis in MATLAB

    b. Assignment 10: Notch Filter for Interference Removal

    11. Laplace Transform

    a. Example: Laplace transform visualization in MATLAB

    b. Assignment 11: Visualizing the Laplace Transform

    12. Image Signals

    a. Example: image signal analysis in MATLAB

    b. Assignment 12: Image Signal Enhancement and Resizing

  • 7. Fourier Transform

    The Fourier transform is defined as the following integral

    dtetfjF tj )()( (7-1)

    The integral can be implemented using trapz in MATLAB. The only issue that may be raised is

    the integration time interval that cannot be defined in the interval of )( t . Therefore,

    one should select the time interval wide enough to cover all the nonzero parts of the signal. Since

    the term inside the integral is complex, the Fourier transform of a function f(t) would result in a

    complex function F(j). Therefore for the implementation purposes one should be careful about

    the result and return what is desired (e.g. the Fourier transform magnitude, or phase, or both) for

    any specific application. The following example explains it.

    Example: Fourier transform of a rectangular function

    Suppose that the Fourier transform magnitude, |F(j)|, of a rectangular function is to be

    calculated and plotted with respect to the frequency. The following program shows how to define

    a rectangular function f(t) in the time interval of ]55[ t (sec), to calculate the

    corresponding Fourier transform F(j), and to plot its magnitude |F(j)| versus frequency in the

    frequency interval of sec)/(]5050[ rad . The resulting plots are displayed in Figure 7-2.

  • Figure 7-1. Implementation of a rectangular function and the corresponding Fourier transform.

    Figure 7-2. Rectangular signal and its Fourier transform magnitude.

    clc; clear all; close all; %-----------Rectangular function----------- t = -5 : 0.001 : 5; f = zeros(size(t)); for i = 1 : length(t) if abs(t(i))

  • Assignment 7: Fourier Transform

    In this assignment, we want to implement the Fourier transform in MATLAB. The goal is to

    write a function which calculates the Fourier transform coefficients of a given function, and to

    apply the function to a synthetic and a real signal.

    a. Write a MATLAB function, [F]= FT(f,t,omega), which gets the values of the input function f(t) in a vector f, the vector of time positions t (t in sec), and the vector of omega

    (specifying the frequency resolution for the Fourier transform) as the input arguments so

    as to calculate and return the Fourier transform (in a vector F with the same size as

    omega). The Fourier transform is defined as below:

    dtetfjF tj )()(

    For integration purposes, use the trapz command available in MATLAB. The integral is

    applied to the expression tjetf )( within the time interval determined by the vector t.

    b. Write a MATLAB program (m-file) in which the following periodic functions is defined in the time interval of [0 5] sec with the step size of 0.001.

    (i) )50cos()( ttf

    (ii) )3

    100sin()(

    ttg

    (iii) )3

    100sin()50cos()(

    ttth

    Then define a vector, omega, in the interval [-200 200] rad/sec with the step-size of 2

    and call your function from part (a), FT, to obtain the Fourier transform in the vectors F,

    G, and H. Plot |F(j)|, |G(j)|, and |H(j)| with respect to in 3 subplots. From your

    plots, find and report all the frequency components (in Hertz) of each signal.

    c. Write a MATLAB program (m-file) in which the EKG signal provided in the lab is loaded into the variables x and t. First, subtract the mean of signal from itself. Then

    define omega vector in the interval [0 200] with the step-size of 2/100 and call your function from part (a), FT, to obtain the Fourier transform (X) of the EKG signal.

    (i) Plot |X(j)| with respect to .

    (ii) Find the fundamental frequency of the quasi-periodic EKG signal on the plot and calculate the average heartbeat per minute. Explain your observations on the plot.

    (iii) A noticeable peak is seen within the frequency range of [300 400] rad/sec. Calculate and report this peaks corresponding frequency in Hertz. Explain what the source of this component is, and why this frequency peak is happening.