Lab 4: First/Second Order DT Systems and a Communications Example (Second Draft)

Similar documents
Lab 1: First Order CT Systems, Blockdiagrams, Introduction

The University of Texas at Austin Dept. of Electrical and Computer Engineering Final Exam

Problem Set 1 (Solutions are due Mon )

The University of Texas at Austin Dept. of Electrical and Computer Engineering Midterm #2

Wireless Communication

2.1 BASIC CONCEPTS Basic Operations on Signals Time Shifting. Figure 2.2 Time shifting of a signal. Time Reversal.

Boise State University Department of Electrical and Computer Engineering ECE 212L Circuit Analysis and Design Lab

EELE 4310: Digital Signal Processing (DSP)

LECTURER NOTE SMJE3163 DSP

Sinusoids. Lecture #2 Chapter 2. BME 310 Biomedical Computing - J.Schesser

Outline. EECS 3213 Fall Sebastian Magierowski York University. Review Passband Modulation. Constellations ASK, FSK, PSK.

Basic Signals and Systems

Project 2 - Speech Detection with FIR Filters

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

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District DEPARTMENT OF INFORMATION TECHNOLOGY DIGITAL SIGNAL PROCESSING UNIT 3

Final Exam Solutions June 14, 2006

Project I: Phase Tracking and Baud Timing Correction Systems

Lecture 17 z-transforms 2

CHAPTER 6 INTRODUCTION TO SYSTEM IDENTIFICATION

Lecture 2 Review of Signals and Systems: Part 1. EE4900/EE6720 Digital Communications

1. Clearly circle one answer for each part.

Experiments #6. Convolution and Linear Time Invariant Systems

ECE503: Digital Filter Design Lecture 9

Fourier Transform Analysis of Signals and Systems

Signals and Systems Lecture 6: Fourier Applications

Spring 2018 EE 445S Real-Time Digital Signal Processing Laboratory Prof. Evans. Homework #1 Sinusoids, Transforms and Transfer Functions

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

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

Frequency Response Analysis

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

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

Digital Processing of Continuous-Time Signals

Digital Processing of

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

Signals and Systems Lecture 6: Fourier Applications

Lab 10: Phase and Hybrid Amplitude/Phase Shift Keying, Carrier Sync

Infinite Impulse Response Filters

PULSE SHAPING AND RECEIVE FILTERING

Lecture 3 Complex Exponential Signals

ECE 203 LAB 2 PRACTICAL FILTER DESIGN & IMPLEMENTATION

AC BEHAVIOR OF COMPONENTS

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

EECS 216 Winter 2008 Lab 2: FM Detector Part II: In-Lab & Post-Lab Assignment

Chapter-2 SAMPLING PROCESS

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

Digital Signal Processing Lecture 1 - Introduction

ECE 301, final exam of the session of Prof. Chih-Chun Wang Saturday 10:20am 12:20pm, December 20, 2008, STEW 130,

Laboratory Assignment 4. Fourier Sound Synthesis

Introduction to Signals and Systems Lecture #9 - Frequency Response. Guillaume Drion Academic year

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

Lab 8: Frequency Response and Filtering

Final Exam. EE313 Signals and Systems. Fall 1999, Prof. Brian L. Evans, Unique No

Midterm 1. Total. Name of Student on Your Left: Name of Student on Your Right: EE 20N: Structure and Interpretation of Signals and Systems

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

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

Basics of Digital Filtering

Chapter 6 CONTINUOUS-TIME, IMPULSE-MODULATED, AND DISCRETE-TIME SIGNALS. 6.6 Sampling Theorem 6.7 Aliasing 6.8 Interrelations

Infinite Impulse Response (IIR) Filter. Ikhwannul Kholis, ST., MT. Universitas 17 Agustus 1945 Jakarta

EECS 216 Winter 2008 Lab 2: FM Detector Part I: Intro & Pre-lab Assignment

ECE 201: Introduction to Signal Analysis

Signal Processing. Introduction

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

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

Bode plot, named after Hendrik Wade Bode, is usually a combination of a Bode magnitude plot and Bode phase plot:

y(n)= Aa n u(n)+bu(n) b m sin(2πmt)= b 1 sin(2πt)+b 2 sin(4πt)+b 3 sin(6πt)+ m=1 x(t)= x = 2 ( b b b b

Signals and Systems EE235. Leo Lam

DSP First. Laboratory Exercise #7. Everyday Sinusoidal Signals

HW 6 Due: November 3, 10:39 AM (in class)

PYKC 13 Feb 2017 EA2.3 Electronics 2 Lecture 8-1

Digital Communication System

Lecture 9. Lab 16 System Identification (2 nd or 2 sessions) Lab 17 Proportional Control

Implementation of Digital Signal Processing: Some Background on GFSK Modulation

Electrical & Computer Engineering Technology

COURSE OUTLINE. Introduction Signals and Noise Filtering: LPF1 Constant-Parameter Low Pass Filters Sensors and associated electronics

Lecture 7 Frequency Modulation

George Mason University Signals and Systems I Spring 2016

Multirate Digital Signal Processing

Chapter 7 Filter Design Techniques. Filter Design Techniques

Lab S-5: DLTI GUI and Nulling Filters. Please read through the information below prior to attending your lab.

FREQUENCY RESPONSE AND PASSIVE FILTERS LABORATORY

Objectives. Presentation Outline. Digital Modulation Lecture 03

Principles of Communications ECS 332

IIR Filter Design Chapter Intended Learning Outcomes: (i) Ability to design analog Butterworth filters

Communication Engineering Prof. Surendra Prasad Department of Electrical Engineering Indian Institute of Technology, Delhi

Lab 6 rev 2.1-kdp Lab 6 Time and frequency domain analysis of LTI systems

EE 422G - Signals and Systems Laboratory

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

II Year (04 Semester) EE6403 Discrete Time Systems and Signal Processing

Digital Communication System

Frequency Division Multiplexing Spring 2011 Lecture #14. Sinusoids and LTI Systems. Periodic Sequences. x[n] = x[n + N]

Design and comparison of butterworth and chebyshev type-1 low pass filter using Matlab

(Refer Slide Time: 02:00-04:20) (Refer Slide Time: 04:27 09:06)

Continuous-Time Analog Filters

Handout 2: Fourier Transform

Subtractive Synthesis. Describing a Filter. Filters. CMPT 468: Subtractive Synthesis

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

Poles and Zeros of H(s), Analog Computers and Active Filters

ECE5713 : Advanced Digital Communications

Lecture 4 Frequency Response of FIR Systems (II)

Rotary Motion Servo Plant: SRV02. Rotary Experiment #03: Speed Control. SRV02 Speed Control using QuaRC. Student Manual

Transcription:

ECEN 33 Linear Systems Spring 3-- P. Mathys Lab 4: First/Second Order DT Systems and a Communications Example (Second Draft Introduction The main components from which linear and time-invariant discrete-time (LTI DT systems are made are adders, gains, and delay or memory elements. DT systems use DT sequences x n as inputs and produce DT sequences y n as outputs. The index n is an integer and x n, y n, and the state of a DT system are undefined when n is not an integer value. In practice DT signals are very often obtained by sampling continuous-time (CT signals with a sampling rate F s = /T s samples per second or hertz (Hz. Time t in seconds is then related to the index values n by t = n T s = n/f s. DT systems are typically implemented using digital computers in the form of microprocessors or DSP (digital signal processing chips which are essentially computers whose architecture has been optimized for DT signal processing.. Difference Equations Consider the first order CT lowpass filter (LPF with system function H L (s = Y (s X(s = ω L s + ω L. In the time domain this is described by the differential equation y ( (t + ω L y(t = ω L x(t, where x(t is the input and y(t is the output of the LPF. One way to convert this to a discrete time (DT system is to approximate the derivative by y ( (t y(t y(t T s T s, and to evaluate the differential equation at discrete time instants t = nt s, i.e., y ( (nt s + ω L y(nt s = ω L x(nt s = y(nt s y(nt s T s T s + ω L y(nt s = ω L x(nt s, where n is an integer and F s = /T s is the sampling rate in samples per second. Replacing y(nt s by y n and x(nt s by x n yields y n y n T s + ω L y n = ω L x n = y n y n + Ω L y n = Ω L x n,

where ω L T s = ω L /F s = Ω L is normalized frequency in radians. Thus, the system described by the first order difference equation ( + Ω L y n y n = Ω L x n, can be interpreted as a DT version of a first order LPF. A block diagram, using an adder, gains, and a delay cell D, that implements this difference equation is shown below. y n x n + Ω L + + y n +Ω L D y n More generally, an N-th order DT system is described by a difference equation that relates the output y n and its shifts y n,..., y n N to the input x n and its shifts x n,..., x n N. To be able to work conveniently with difference equations and to obtain system functions for DT systems, the next step is to use a transformation that converts time shifts into multiplicative operators.. z-transform The unilateral or one-sided z-transform X(z of a DT sequence x n, n, is defined as X(z = x n z n, n= and if x n < r for all n > n, then X(z converges for all values of z in the complex z-plane outside a circle of radius r. Example: DT Exponential. The DT exponential function a n u n has z-transform a n z n = n= a z, if a z <. The region of convergence (ROC of this z-transform is z > a, i.e., the whole z-plane outside a circle of radius a. Note that if a = then the transform pair u n is obtained. A related z-transform pair is δ n z δ n z n = n=

where the DT impulse δ n = if and only if n =. Example: DT Sinusoids. The complex-valued DT exponential function e ±jω n u n has z-transform e ±jω n z n =, ROC: z >. e ±jω z Using Euler s relation n= cos(ω n u n = ejω n + e jω n u n cos(ω z cos(ω z + z and sin(ω n u n = ejω n e jω n j u n sin(ω z cos(ω z + z z-transform Properties. Linearity. The z-transform is linear, i.e., α x [n] + β x [n] α X (z + β X (z, for any (real or complex valued constants α and β. Time Shift. If x n X(z, then x n has z-transform x n z n = x + z n= n= x n z (n, and thus x n z X(z + x, where z is recognized as a multiplicative delay operator..3 First Order DT Systems The difference equation of a general first order DT system is of the form y n + a y n = b x n + b x n. Using the one-sided z-transform and assuming zero intial conditions, this yields ( + a z Y (z = (b + b z X(z = H(z = Y (z X(z = b + b z + a z. - To be completed - 3

.4 Second Order DT Systems A general second order DT system is characterized in the time domain by a difference equation of the form In the z-domain this translates into and thus y n + a y n + a y n = b x n + b x n + b x n. ( + a z + a z Y (z = (b + b z + b z X(z, if zero initial conditions are assumed. - To be completed - H(z = Y (z X(z = b + b z + b z + a z + a z,.5 Frequency Response of DT Systems - To be completed -.6 First Order DT LPF The system function of a first order DT LPF with a zero at z = and a pole at z = r is The frequency response of this system is H L (z = K + z r z. H L (e jω = K + e jω + cos Ω j sin Ω = K r e jω r cos Ω + j r sin Ω = K + e jω r e jω ( r( + cos Ω j( + r sin Ω = K, r e jω r ejω r cos Ω + r where the first form is more suitable for the computation of H L (e jω and the second form is better suited for the computation of H L (e jω. Note that H L (e j = K r = select K = r for a dc gain of. With this value of K the magnitude squared of the frequency response is H L (e jω = ( r 4 ( + cos Ω + sin Ω ( r cos Ω + r sin Ω = ( r 4 ( + cos Ω + r r cos Ω. 4

The -3 db (or half power frequency Ω 3 is thus defined implicitly as H L (e jω 3 = ( r 4 ( + cos Ω 3 + r r cos Ω 3 =. From this it follows that ( r ( + cos Ω 3 = + r r cos Ω 3 = cos Ω 3 = r + r. Using the trigonometric identity this can be converted to tan ( α ( tan Ω3 = cos Ω 3 = + r r + cos Ω 3 + r + r = cos α + cos α, ( ( r r = = Ω ( + r 3 = tan. + r Another frequency of interest is Ω 45, the frequency at which the phase response H(e jω is 45. The phase response of a first order DT LPF is (from the second form of H(e jω given above ( H(e jω = tan ( + r sin Ω. ( r( + cos Ω Therefore, Ω 45 is defined by ( + r sin Ω 45 ( r( + cos Ω 45 = = r + r = sin Ω 45 = tan + cos Ω 45 where the last equality is the trigonometric identity ( α tan = sin α + cos α. ( Ω45 The interpretation of the result is that Ω 3 = Ω 45 for a first order DT LPF, which is the same property that a first order CT LPF has.,.7 Second Order DT LPF A second order DT LPF with poles at r e ±jθ, r <, has system function H L (z = K ( + z ( r e jθ z ( r e jθ z = K ( + z r cos θ z + r z. Note that H L ( = K 4 r cos θ + r, and H L( =. 5

For a dc gain of, set K to K = r cos θ + r 4 = H L (z = Multiplying top and bottom by z yields r cos θ + r 4 ( + z r cos θ z + r z. H L (z = r cos θ + r 4 The frequency response of this system is z + + z z r cos θ + r z. H L (e jω = r cos θ + r 4 e jω + + e jω e jω r cos θ + r e jω. Use Euler s relation for e ±jω to obtain H L (e jω = r cos θ + r 4 ( + cos Ω ( + r cos Ω r cos θ + j ( r sin Ω. Thus, the magnitude squared of the frequency response is H L (e jω = ( r cos θ + r 6 and the phase of the frequency response is 4 ( + cos Ω ( ( + r cos Ω r cos θ + ( r sin Ω, ( H L (e jω = tan ( r sin Ω. ( + r cos Ω r cos θ To determine the normalized natural frequency Ω, which is defined as the frequency at which the phase of the LPF is 9, look at This is satisfied if ( H L (e jω = tan ( r sin Ω = 9. ( + r cos Ω r cos θ ( + r cos Ω r cos θ = = cos Ω = r cos θ. + r Using the trigonometric formula tan ( α this result can be reformulated as ( tan Ω = cos α + cos α = sin α ( cos α = ( + cos α sin, α = cos Ω + cos Ω = + r r cos θ + r + r cos θ, 6

and thus ( Ω = tan + r r cos θ. + r + r cos θ The frequency response at Ω is H L (e jω = = = = r cos θ + r ( + cos Ω 4 ( + r cos Ω r cos θ +j( r }{{} sin Ω = r cos θ + r + cos Ω r cos θ + ( r = tan ( Ω j ( r sin Ω j ( r r cos θ + r + r + r cos θ ( + j ( r + r r cos θ = r r cos θ( + r + r cos θ j ( r ( + r 4r cos θ. j ( r For a nd order CT LPF H L (jω = /(jζ. Thus, for a nd order DT LPF, the damping ratio ζ can be defined as H L (e jω = ( + r 4r cos θ j ( r = j ζ = ζ = r ( + r 4r cos θ..8 Second Order DT BPF Consider the following system function of a second order DT BPF H B (z = K ( z ( + z ( r e jθ z ( r e jθ z = K z r cos θ z + r z, with poles at z = re ±jθ and zeros at z = ±. Multiply top and bottom by z to obtain H B (z = K The frequency response can then be written as H B (e jω = K e jω e jω e jω r cos θ + r e jω = K z z z r cos θ + r z. Thus, the phase of the frequency response of the BPF is j sin Ω ( + r cos Ω r cos θ + j( r sin Ω. ( H B (e jω = 9 tan ( r sin Ω. ( + r cos Ω r cos θ 7

For a BPF the normalized natural frequency Ω is defined as the frequency at which H(e jω =. This occurs when the argument of the inverse tangent becomes infinity and therefore ( + r cos Ω r cos θ = = cos Ω = r + r cos θ. Using the trigonometric identity for tan(α/ this can also be written as ( tan Ω = cos Ω = + r r cos θ + cos Ω + r + r cos θ ( = Ω = tan + r r cos θ, + r + r cos θ which is the same result as the one found for the nd order DT LPF. Using ( + r cos Ω r cos θ = in H B (e jω at Ω = Ω yields H B (e jω j sin Ω = K ( + r = K cos Ω r cos θ +j( r }{{} sin Ω = Since Ω is also the center frequency of a second order BPF, the choice K = r adjusts the maximum gain of the BPF to at the center frequency Ω., j sin Ω = K j( r sin Ω r..9 Frequency Response Measurement for DT Systems The simplest way to measure the magnitude of the frequency response of a DT system in Simulink is to use a sweeping sinusoid ( chirp signal with a desired frequency range as input signal and then to display the absolute value (or the logarithm of the absolute value of the signal at the output of the DT system. Consider the following first order system. 8

To generate a DT sinusoidal input signal x n with a sweeping frequency from. to π rad on a logarithmic scale, the following Matlab code can be used: WW =.; %Normalized start frequency [rad] WW = pi; %Normalized end frequency [rad] nlen = ; %# of samples for chirp nn = [:nlen]; %Index n axis WW = logspace(log(ww,log(ww,length(nn; %Log-spaced W axis theta = cumsum(ww; %Phase theta[n] for chirp signal xn = cos(theta; %Sweeping cosine (chirp signal To run the Simulink model with this input for the case when H(z = K the Matlab code shown next is added: + z a z, with K = a, and a =.8, a =.8; %Pole location b = (-a/*[ ]; %Numerator of H(z a = [ -a]; %Denominator of H(z t = nn ; %Input for Simulink model u = xn ; sim( DTsys,[t( t(end] %Run Simulink model %Fixed step (size, discrete solver yn = yout ; %Sinusoidal response of model The Configuration Parameters used for running the Simulink model are: Solver Type: Fixed-step Solver: Discrete (no continuous states Fixed-step size: Input: [t,u], checked Limit data points to last:, unchecked A plot of log ( H(e jω versus Ω on a logarithmic scale is shown below. Frequency Response of DT System, b=[.,.], a=[,.8] log H(e jω [db] 3 4 5 Ω [rad] (log scale 9

When it is desired to use a linear Ω axis, the chirp signal can be generated as WW = ; %Normalized start frequency [rad] WW = pi; %Normalized end frequency [rad] nlen = ; %# of samples for chirp nn = [:nlen]; %Index axis WW = linspace(ww,ww,length(nn; %Lin-spaced W axis theta = cumsum(ww; %Phase theta[n] for chirp signal xn = cos(theta; %Sweeping cosine (chirp signal The graph below shows H(e jω versus a linear Ω/π axis for the same DT system as before. Frequency Response of DT System, b=[.,.], a=[,.8].8 H(e jω.6.4....3.4.5.6.7.8.9 Ω/π. Step-Invariant CT to DT Conversion If a CT system is replaced by a DT system, not all features of the CT system (even if it is bandlimited can be preserved. If it is important to duplicate the unit step response as closely as possible, then a step-invariant CT to DT conversion can be used. Starting from the CT system function H(s one can obtain G(s and, using the inverse Laplace transform, the CT unit step response g(t. Using a sampling rate F s = /T s, the DT unit step response then becomes g n = g(n T s. The z-transform of g n is G(z which then leads to the DT system function as H(z = ( z G(z. Example: Step-Invariant st Order LPF CT to DT Conversion. Start from the CT LPF H(s = ω L ω L = G(s = s+ω L s (s+ω L = s = g(t = ( e ω Lt u(t. s+ω L Next, sampling g(t at t = n T s yields g n = g(n T s = ( e Ω Ln u n = G(z = z e = ( e ΩL z Ω L z ( z ( e Ω L z,

where Ω L = ω L /F s. From this the DT system function is obtained as H(z = ( z G(z = ( e Ω L z e Ω L z = e ΩL z e Ω L Thus, H(z has a pole p = e Ω L, a zero at infinity, and. H( = (dc gain, and H( = e Ω L + e Ω L (gain at Ω = π. Graphs of g(t and g n = g(nt s are shown in the figure below for ω L = 5 rad/sec and F s = Hz. Step Invariant LPF CT > DT, ω L =5, F s = Hz, F ss = Hz.9.8.7 g(t, g n =g(nt s.6.5.4.3.. CT: g(t DT: g(n/fs..4.6.8..4.6.8 t [sec] The sampling rate F ss is the rate that was used to simulate the CT model in Simulink. As expected, the unit step response of the DT and the CT systems are identical at the sampling time instants. But for the magnitude and the phase of the frequency response shown below, discrepancies between the DT and the CT system are clearly visible.

H(jω, H(e jω/fs.8.6.4. Step Invariant LPF CT > DT, ω L =5, F s = Hz CT: H(jω DT: H(e jω/fs 5 5 5 3 35 4 45 5 ω [rad/sec] H(jω, H(e jω/fs [deg] 5 5 5 CT: H(jω DT: H(e jω/fs 3 5 5 5 3 35 4 45 5 ω [rad/sec] Note that the frequency response plots were generated using the freqs (for the CT system and the freqz (for the DT system commands in Matlab. Example: Step-Invariant nd Order LPF CT to DT Conversion. A second order CT LPF with natural frequency ω and damping ratio ζ, < ζ, has system function H(s = ω s + ζω s + ω = ω (s + α jβ(s + α + jβ, where α = ζω and β = (ζ. Note that α +β = ω. The unit step response is obtained from ω G(s = s (s + α jβ(s + α + jβ = A s + B s + α jβ + B s + α + jβ, as g(t = A + B e αt e jβt + B e αt e jβt, for t >, where A = and ω B = = s(s+α+jβ s= α+jβ ω ( α+jβjβ = ω /(β β + jα Note that B = ω β = ( α ζ, and B = tan β jα = β β = + jα β. ( α = π tan. β

Sampling g(t at t = nt s, where F s = /T s is the sampling rate, yields g(nt s = A + B e αnts e jβnts + B e αnts e jβnts, for n. Define g n = g(nt s, Ω α = α = ζω F s F s, Ω β = β = F s and rewrite the sampled step response as ζ ω F s, The z-transform of this is g n = A + B e Ωαn e jω βn + B e Ωαn e jω βn, for n. G(z = A z + B e Ωα e + B jω β z e Ωα e. jω β z To obtain the DT system function H(z, multiply by z : H(z = A + B( z e Ωα e jω β z + B ( z e Ωα e jω β z = b + b z + b z e Ωα cos Ω β z + e Ωα z, where b = A + B + B =, b = e Ωα ( A cos Ωβ + B cos( Ω β + B Re{B}, b = Ae Ωα + B e Ωα cos( Ω β + B. Plots of g(t and g n = g(nt s are shown in the following figure for ω = 5 rad/sec, ζ = /, when F s = Hz..4 Step Invariant LPF Order CT > DT, ω =5, ζ=.5, F s = Hz, F ss = Hz. g(t, g n =g(nt s.8.6.4. CT: g(t DT: g(n/fs.5.5.5 3 3.5 4 4.5 5 t [sec] As can be seen, the step responses of the CT and DT systems are identical at the sampling time instants. But the next two plots show that the magnitude and the phase responses of the CT and DT systems differ, especially near ω = π F s. 3

Step Invariant LPF Order CT > DT, ω =5, ζ=.5, F s = Hz H(jω, H(e jω/fs 3 4 CT: H(jω DT: H(e jω/fs 5 5 5 5 3 35 4 45 5 ω [rad/sec] H(jω, H(e jω/fs [deg] 5 5 CT: H(jω DT: H(e jω/fs 5 5 5 5 3 35 4 45 5 ω [rad/sec]. Step Response Measurement for DT Systems To generate and display the step response g n of a DT system in Simulink, start from generating an index axis nn and a unit step un as shown below. nlen = 5; nstep = 5; nn = [:nlen]; un = zeros(size(nn; ix = find(nn>=nstep; un(ix = ones(size(ix; %# of samples for g[n] %Step index %Index axis for g[n] %Prepare unit step %Unit step starts at nstep %DT unit step signal Note that nlen and nstep may have to be adjusted depending on the properties of the system to be measured. To obtain the step response of a first order DT system with H(z = K the following Matlab code can be used: + z a z, with K = a, and a =.8, 4

a =.8; %Pole location b = (-a/*[ ]; %Numerator of H(z a = [ -a]; %Denominator of H(z t = nn ; %Input for Simulink model u = un ; sim( DTsys,[t( t(end] %Run Simulink model %Fixed step (size, discrete solver gn = yout ; %Step response The Configuration Parameters used for running the Simulink model are: Solver Type: Fixed-step Solver: Discrete (no continuous states Fixed-step size: Input: [t,u], checked Limit data points to last:, unchecked The graph below shows the unit step response of the DT system. Step Response of DT System, b=[.,.], a=[,.8].8 g[n].6.4. 5 5 5 3 35 4 45 5 n The command that was used to produce the stem plot in Matlab is stem(nn,gn,.-r. Application: FSK Data Transmission Frequency shift keying (FSK is a data transmission method for digital data that uses sinusoids with different frequencies to transmit different data values. The simplest case is binary FSK which uses two different frequencies, f to transmit binary or space (S and f to transmit binary or mark (M. One way to describe a binary FSK signal s(t is as follows. Let d n be the binary data sequence that is to be transmitted and define d [n] = {, if dn =,, if d n =, d [n] = d n. 5

Then use the DT sequences d [n] and d [n] to define the two CT data waveforms d (t = d [n] p(t nt B, and d (t = n= d [n] p(t nt B, where F B = /T B is the symbol or baud rate at which the data is transmitted and p(t is a rectangular pulse of width T B and amplitude, i.e., {, if t < TB, p(t =, otherwise. The next step is to convert d (t and d (t to sinusoidal on-off signals s (t and s (t with frequencies f and f by setting s (t = d (t cos(πf t + θ, and s (t = d (t cos(πf t + θ. In general, the phases θ and θ of s (t and s (t could be fixed or time varying and may or may not be known at the receiving end. Finally, the complete binary FSK signal is s(t = s (t + s (t = d (t cos(πf t + θ + d (t cos(πf t + θ. An example of an FSK signal with F B = baud, f = 3 Hz, f = Hz is shown below for the data sequence d n = [,,,,,,,,, ]. n= FSK Example: f =3 Hz, f = Hz, F B = Baud, d n =[,,,,,,,,,] d (t, s (t d (t, s (t...3.4.5.6.7.8.9....3.4.5.6.7.8.9. d (t, s(t.5.5.5.5...3.4.5.6.7.8.9. t [sec] 6

The first graph shows d (t (dashed, green and s (t (solid, blue and the second graph shows d (t (dashed, green and s (t (solid, blue. The third graph shows the FSK signal s(t that actually transmits the data sequence d n, and the data pattern is easy to see directly by visual inspection. Let r(t = γs(t, where γ represents the attenuation of the transmission channel, be a received binary FSK signal. The goal of an FSK receiver is to recover the transmitted data sequence d n, despite the unknown channel attenuation, phase and frequency errors, and noise picked up during the transmission. Conceptually, the simplest way to do this is is to use two bandpass filters (BPF, one centered at f and one centered at f. At suitably chosen sampling time instants T B seconds apart, the average power (averaged over T B seconds at the outputs of the BPFs is compared and d n is set to one if the average power at f is larger than the average power at f ; otherwise d n is set to zero. Another approach is to use the fact that the product of two sinusoids with frequencies f a and f b yields the sum of two sinusoids, one at the difference frequency f a f b and the other one at the sum frequency f a + f b. In this way the signal s (t can be shifted down to dc (or baseband by multiplication with a sinusoid with frequency f, and s (t can be shifted down to dc (or baseband by multiplication with a sinusoid with frequency f. One slight problem is that in general the phases of the sinusoids that were used at the transmitter are not known at the receiver. This problem can be solved by multiplying the received signal with both a sine and a cosine at the frequencies f and f at the receiver. The block diagram of a FSK receiver that uses this strategy is shown in the figure below. v i (t cosπf t v q (t LPF v Li (t at f L (. LPF v Lq (t at f L (. + + + ˆd (t r(t sinπf t v i (t cosπf t v q (t LPF v Li (t at f L (. LPF v Lq (t at f L (. + + + ˆd (t sinπf t Using the trigonometric identities cos α cos β = [ ] [ ] cos(α β+cos(α+β, and cos α sin β = sin(α β sin(α+β, 7

the quantity v i (t after multiplication of r(t with cos πf t is computed as v i (t = r(t cos πf t = γ ( d (t cos(πf t + θ + d (t cos(πf t + θ cos πf t = γd (t cos θ + γd (t cos(4πf t + θ + +γd (t cos(π(f f t + θ + γd (t cos(π(f + f t + θ. The main term of interest is the underlined γd (t cos θ. All other terms are at higher frequencies, like f, and f ± f. Thus, if the LPF at f L is designed to reject these frequencies, then v Li = γd (t cos θ. The quantity v q (t is similarly computed as v q (t = r(t sin πf t = γ ( d (t cos(πf t + θ + d (t cos(πf t + θ sin πf t = γd (t sin θ γd (t sin(4πf t + θ + +γd (t sin(π(f f t + θ γd (t sin(π(f + f t + θ. Except for the term of interest (underlined, all other terms are at higher frequencies, namely f, and f ±f. Thus, using an LPF that rejects these terms, results in v Lq = γd (t sin θ. But note that the LPFs need to have sufficient bandwidth to pass a data sequence of alternating s and s which has a fundamental frequency of F B /. The last step needed to obtain an estimate ˆd (t of d (t is ˆd (t = ( γd (t cos θ + ( γd (t sin θ = γ d (t. The quantities v Li (t and v Lq (t are obtained using entirely analogous computations as v Li (t = γd (t cos θ, and v Lq (t = γd (t sin θ, and thus the estimate ˆd (t of d (t is ˆd (t = ( γd (t cos θ + ( γd (t sin θ = γ d (t. From ˆd (t and ˆd (t the CT version ˆd(t of the received data sequence ˆd n can be obtained as ˆd(t = {, if ˆd (t ˆd (t,, otherwise, for any given value of t. Finally, ˆd n is recovered by sampling ˆd(t as ˆd n = ˆd(nT B + τ, where τ is a suitably chosen delay which compensates for the delay through the LPFs at the receiver. The next figure shows v i (t, v Li (t, v q (t, v Lq (t, v i (t, v Li (t, and v q (t, v Lq (t, for the sample FSK signal that was given earlier. The LPFs that were used to produce the graphs were nd order LPFs with ω = πf B / and ζ = /. 8

FSK Receiver: f =3 Hz, f = Hz, F B = Baud, d n =[,,,,,,,,,] v i (t, v Li (t v q (t, v Lq (t v i (t, v Li (t v q (t, v Lq (t...3.4.5.6.7.8.9....3.4.5.6.7.8.9....3.4.5.6.7.8.9....3.4.5.6.7.8.9. t [sec] The next set of graphs shows ˆd (t, ˆd (t, ˆd(t, and the sampled values at times t = nt B + τ. The sampling delay τ is approximately equal to T B. FSK Receiver: f =3 Hz, f = Hz, F B = Baud, d n =[,,,,,,,,,] dhat (t...3.4.5.6.7.8.9. dhat (t...3.4.5.6.7.8.9..5 dhat(t.5.5...3.4.5.6.7.8.9. t [sec] 9

From the samples in the last graph it is easy to see that the transmitted data sequence can be successfully recovered at the receiver. Prelab Questions P. Phase Shift of First Order DT Filters. Let H(z = K z z p z, be the system function of a first order DT system. Assuming that the system is BIBO stable and z <, determine for which values of p and z the phase H(e jω of the frequency response is > and for which it is <. P. Pole-Zero Specification of DT System. The following pole-zero plot defines a second order DT system with real poles at a and a. Im{z} <a< -a a Re{z} Determine the system function H(z such that max Ω H(e jω =. What type of filter is this? What is the unit step response g n of this system? P3. Step Invariant CT to DT System Conversion. (a Start from the CT system with system function H(s = s. s + ω x Determine the system function H(z of the corresponding step-invariant DT system. (b Repeat (a for the CT system with system function H(s = ζω s s + ζω s + ω. Assume that < ζ.

3 Lab Experiments E. Pole/Zero Placement for First and Second Order DT Systems. The goal of this experiment is to explore the relationship between pole/zero placement and the step and frequency responses of first and second order DT systems. Use the Simulink model shown below for first order DT systems. The Simulink model shown in the next figure is used to simulate second order DT systems. In both cases use the following Configuration Parameters for running the Simulink model: Solver Type: Fixed-step Solver: Discrete (no continuous states Fixed-step size:

Input: [t,u], checked Limit data points to last:, unchecked (a Let H(z be the first order system function H(z = K z z p z, with zero z and pole p. Make plots of the magnitude of the frequency response H(e jω, the unit step response g n, and the pole/zero locations for the following combinations of poles and zeros: p =.9,.3 and z =,, + (6 combinations. In each case choose K such that the passband gain (dc gain for LPF, center frequency gain for BPF, gain at highest frequency for HPF of H(z is. If the -3 db frequency is much smaller than π, display the magnitude of the frequency response in db versus Ω on a logarithmic scale, as shown in the example below. Frequency Response of DT System, b=[.5,], a=[,.95] log H(e jω [db] 3 4 5 Ω 3 Ω [rad] (log scale Step Response Pole Zero Plot.8.5 g[n].6.4. Im{z}.5 5 5 n.5.5 Re{z} If the -3 db frequency is close to or larger, then use a linear display for H(e jω as shown in the next example.

Frequency Response of DT System, b=[.45,.45], a=[,.].8 H(e jω.6.4..5 Ω.5.5 3 3.5 3 Ω [rad] Step Response Pole Zero Plot.8.5 g[n].6.4. Im{z}.5 4 6 8 n.5.5 Re{z} For which values of z do you get LPFs? For which do you get HPFs? What happens if z = /p is selected? For which values of p can you use a straight line Bode plot approximation for H(e jω over at least one decade to the left and to the right of the -3dB frequency? (b Let H(z be the second order DT system function H(z = K ( z z ( z z ( re jθ z ( re jθ z, with zeros z, z, poles re ±jθ and gain factor K. Now there are essentially three quantities that determine the behavior of the system: The location of the zeros, often at z =, z =, or both, the magnitude r, and the angle θ of the complex conjugate poles. Consider the following three sets of zero locations: z = z =, z =, z =, and z = z =. Make plots of the magnitude of the frequency response H(e jω, the unit step response g n, and the pole/zero locations for the three sets of zero locations and the following r, θ combinations: (i r =.93, θ = 4. (ii r =.98, θ = 4. (iii r =.5, θ = 5. (iv r =.8, θ = 5. 3

In each case adjust the gain factor K so that the passband gain of the system is. What determines whether H(z is the system function of a LPF, BPF, or HPF? Try to determine the natural frequency Ω and the damping factor ζ for each of the cases above. Which parameters determine the values of Ω and ζ? Hint: In addition to using Simulink, consider also using the freqz command to plot the magnitude and the phase of the frequency response. Depending on the pole locations you may want to choose between a logarithmic or a linear display of the frequency response. For which of the above cases would a straight line Bode plot approximation be useful? For which would it not be useful? Here is an example of a logarithmic frequency response display when r =.98 and θ = 45. The purple lines show the sinusoidal output from the Simulink simulation with a chirp signal. The blue line was computed using the freqz command. Frequency Response of DT System, b=[.98,,.98], a=[,.39,.96] log H(e jω [db] 3 4 5 6 Ω [rad] (log scale.5 Step Response Pole Zero Plot.5 g[n] Im{z}.5.5 4 6 8 n.5.5 Re{z} The next figure shows the same system with a linear frequency response display for Ω =... π. 4

Frequency Response of DT System, b=[.98,,.98], a=[,.39,.96].8 H(e jω.6.4..5 Ω.5.5 3 3.5 3 Ω 3 Ω [rad].5 Step Response Pole Zero Plot.5 g[n] Im{z}.5.5 4 6 8 n.5.5 Re{z} The lines at Ω 3 and Ω 3 show the locations of the lower and upper -3dB frequencies of this BPF. (c Suppose you would like to design a second order DT LPF with Ω =.5 radians and ζ = /. Find z, z, r, and θ of the corresponding system function. Determine K such that the dc gain is. How easy (or difficult is it to find these parameters by trial and error? the figure below shows H(e jω and g n of the desired LPF 5

.4 Frequency Response of DT System, with Ω =.5 and ζ=.5. H(e jω.8.6.4..5.5.5 3 3.5 Ω [rad].4 Step Response g[n]..8.6.4. 5 5 5 3 n E. Comparison of CT Systems and their DT Replacements. Modern signal processing implementations use programmable digital hardware whenever possible. A task that is encountered frequently is to convert an idea or a concept or an existing implementation from continuous time to discrete time. Because of the periodic nature of the frequency response of DT systems, a perfect match between CT and DT systems in both the time and frequency domains is impossible for practical implementations. Starting from a given CT system, the goal of this experiment is to determine an approximate DT equivalent and to compare the performance of the two systems in terms of their unit step response and the magnitude and the phase of the frequency response. In Simulink, use the same DT models and Configuration Parameter settings as in experiment. For first and second order CT systems use the following CT models. 6

Because Simulink has to use discrete time instants for both continuous time and discrete time system simulations, two sampling frequencies have to be used. One, which will be denoted by F ss, is the sampling rate used to simulate the CT system. The other one, denoted by F s, is the sampling rate of the DT system that is supposed to replace the CT system. Typically, F ss F s, e.g., F ss =... F s. Here is some sample Matlab code that can be used as a starting point to generate the unit step responses g(t and g n : 7

Fs =... %Sampling rate DT system Fss = *Fs; %Sampling rate CT system bct =... %Numerator of H(s act =... %Denominator of H(s bdt =... %Numerator of H(z adt =... %Denominator of H(z nlen = ; %Number of samples for g[n] nstep = ; %Step index of u[n] un = zeros(size(nn; %Prepare DT unit step ix = find(nn>=nstep; un(ix = ones(size(ix; %DT unit step b = bdt; %DT model parameters a = adt; t = nn ; %Input for Simulink model u = un ; sim( DTsys,[t( t(end] %Run DT Simulink model %Fixed step ( discrete solver gn = yout ; %DT step response tlen = nlen/fs; %Duration of g(t in sec tstep = nstep/fs; %Step time of u(t tt = [:round(tlen*fss-]/fss; %Time axis for g(t ut = zeros(size(tt; %Prepare CT unit step ix = find(tt>tstep; ut(ix = ones(size(ix; %CT unit step b = bct; %CT model parameters a = act; t = tt ; %Input for Simulink model u = ut ; sim( CTsys,[t( t(end] %Run CT Simulink model %Fixed step (/Fss ode3 solver gt = yout ; %CT Step response The Configuration Parameters for running the CT Simulink model are: Solver Type: Fixed-step Solver: ode3 (Bogacki-Shampine Fixed-step size: /Fss Input: [t,u], checked Limit data points to last:, unchecked Here is an example of a step-invariant CT to DT conversion of a st order LPF with ω L = 5 rad/sec, F s = /T s = 8 Hz, and F ss = 8 Hz. The unit step responses g(t and g n are identical at times t = nt s. 8

Step Invariant LPF Order CT > DT, ω L =5, F s =8 Hz, F ss =8 Hz.9.8.7 g(t, g n =g(nt s.6.5.4.3.. CT: g(t DT: g(n/fs.5.5 t [sec].5 3 3.5 4 x 3 The magnitude and the phase of the frequency responses of the CT and DT systems, computed using the freqs and freqz commands, respectively, are shown next. Step Invariant LPF Order CT > DT, ω L =5, F s =8 Hz H(jω, H(e jω/fs 5 5 CT: H(jω DT: H(e jω/fs 5.5.5.5 ω [rad/sec] 3 3.5 4 4.5 5 x 4 H(jω, H(e jω/fs [deg] 3 CT: H(jω DT: H(e jω/fs 4.5.5.5 ω [rad/sec] 3 3.5 4 4.5 5 x 4 There are clearly some differences here, especially for ω near πf s and beyond. Note that the unwrap command was used for the phase to remove phase jumps by ±36. It is instructive to compare this also with a DT LPF with system function H(z = r 9 + z r z.

This has a pole at r. But the main difference is that it has a zero at z =, whereas the step-invariant DT system has no finite zero. The graph below shows the unit step responses of the CT system and the two DT systems. The value of r for the nd DT system is r =.56. Step Invariant LPF Order CT > DT, ω L =5, F s =8 Hz, F ss =8 Hz.9.8.7 g(t, g n =g(nt s.6.5.4.3. CT: g(t. DT: g(n/fs DT: g(n/fs.5.5 t [sec].5 3 3.5 4 x 3 In the frequency response which is shown below for all three systems, the efect of placing a zero at z = for the second DT system is clearly visible. Step Invariant LPF Order CT > DT, ω L =5, F s =8 Hz 5 H(jω, H(e jω/fs 5 5 CT: H(jω DT: H(e jω/fs DT: H(e jω/fs 3.5.5.5 ω [rad/sec] 3 3.5 4 4.5 5 x 4 H(jω, H(e jω/fs [deg] CT: H(jω 3 DT: H(e jω/fs DT: H(e jω/fs 4.5.5.5 ω [rad/sec] 3 3.5 4 4.5 5 x 4 3

(a Replacement of first order CT LPF with system function H L (s = ω L s + ω L, by either a first order step-invariant DT system (DT or a first order DT system with a pole at z = r and a zero at z = (DT. Let ω L = rad/sec and determine the minimum sampling rate F s needed for both DT replacements if the following requirements are set: (i The unit step response g n has to satisfy g n g n. fo all n and g(nt s g n. for all n. Adjust the value of r for the second DT system (DT as necessary. (ii The phase of the frequency response has to satisfy H L (jω H L (e jω/fs 5 for ω ω L. Adjust the value of r for the second DT system (DT as necessary. (b Replacement of second order CT LPF with system function H L (s = ω s + ζω s + ω, by either a second order step-invariant DT system (DT or a second order DT system with poles at z = re jθ and a double zero at z = (DT. Let ω = and ζ =.46 and determine the minimum sampling rate F s needed for both DT replacements if the following conditions have to be met: (i The maximum overshoot of g n has to be between 8% and % and the -3 db frequency of the DT system has to be within ±5% of the -3 db frequency of the CT system. Adjust the values of r and θ for the second DT system (DT as necessary. (ii The maximum overshoot of g n has to be between 8% and % and the magnitude of the frequency response in decibel of the DT system can differ by at most db from the magnitude of the frequency response in decibel of the CT system for frequencies in the range ω =... rad/sec. Adjust the values of r and θ for the second DT system (DT as necessary. E3. Design of a Receiver for FSK Signals. The goal of this experiment is to demodulate binary FSK signals and extract the received ASCII text messages. The parameters used for the FSK signals are identical to the ones that are used for caller ID in the US. The baud (or symbol rate is baud. The frequency to transmit a binary (or space is f = Hz and the frequency to transmit a binary (or mark is f = Hz. A known test signal with the text The quick brown fox jumps over the lazy dog, 3456789. is recorded in the wav file FSKsig.wav with a sampling rate F s = Hz. The ASCII text uses 8 bits per character and the parallel to serial conversion is done such that the LSB (least significant bit is transmitted first, in the same way as described for Lab. (a Write a Matlab script that reads an FSK signal from a wav file and processes it using the FSK receiver described in the introduction. For the LPFs design nd order DT LPFs 3

with natural frequencies (in Hz approximately equal to F B /. Choose a ζ such that the step response of the LPF has an overshoot of about... 5%. Implement the LPFs using Simulink. Use the test FSK signal in FSKsig.wav to test the correct operation of your receiver. (b Use the receiver you designaed in (a to extract the text message from the binary FSK signal in FSKsig.wav. c, P. Mathys. Last revised: 3-9-, PM. 3