Outline • Response due to sinusoidal input. • Frequency response of DT systems. • Properties of the frequency response of DT Systems . • MATLAB commands. • Sampling theorem and the selection of the sampling period. Frequency Response of Discrete-Time Systems M. Sami Fadali Professor of Electrical Engineering UNR 1 2 Impulse Sampled Representation of DT Waveform Sinusoidal SS Response 1. SS Response of an LTI DT system to a sampled sinusoidal input: sinusoid of the same frequency as the input with frequency dependent phase shift and magnitude scaling. 2. Scale factor and phase shift define a complex function of frequency: the frequency response. 3 ∗ • Laplace transform ∗ ∗ ∗ ∗ • Define transfer function for sampled inputs 4 Verification Without Impulse Sampling Frequency Response ∗ ∗ • Substitute ∗ • z-transform • Frequency response ∗ Example: • System z-transfer function ∗ ∗ 5 Response due to Sinusoid 6 Partial Fraction Coefficient • System Output: • Poles inside the unit circle for sufficiently large • Partial fraction coefficient • Partial Fraction Expansion (divide by ) • Inverse z-transform 7 8 Steady-state Output Response to Sampled Sinusoid ∠ • Real part = response due to a sampled cosine input • Imaginary part = response for a sampled sine input • Sampled cosine response • Similar sampled sine response with sine replacing cosine. • Sinusoid of the same frequency scaled and phase shifted (resp.) by the magnitude and angle • Frequency response function obtained earlier using impulse sampling. • Use complex arithmetic to determine the steady-state response due to a sampled sinusoid without z-transformation. 9 Example Properties of the Frequency Response of DT Systems Find the steady-state response of the system 1. DC Gain. 2. Periodic nature of frequency response. 3. Symmetry. due to the sampled sinusoid Solution: For large with . 3 . cos 0.2 1 . 0.1 ∠ cos 0.2 ∠ 6.4 cos 0.2 10 . 0.5 1 . 0.1 . 0.5 0.614 11 12 DC Gain Periodic Nature 1. DC Gain: The DC gain is equal to Frequency response is a periodic function of rad/s. frequency with period Proof: Proof → → • Complex exponential: periodic with period rad/s. single-valued function of its argument. • It also is periodic and has the same repetition frequency. 13 14 Observations Symmetry • For transfer functions with real coefficients 1. Magnitude of TF is an even function of frequency. 2. Phase of TF is an odd function of frequency. • Proof: For negative frequencies, the transfer function is • For real coefficients • Combine the last two equations 15 a)We only need for frequencies from DC to . b)Obtain frequency response for by symmetry. is c)Frequency response periodically repeated for . d)Negligible frequency response amplitudes for no overlap of repeated frequency response cycles. 16 Observations e) Sampling with no overlap periodic repetition of the frequency response of a continuous time system. f) Frequency responses of physical systems are not bandlimited overlapping of the repeated frequency response cycles (folding). = the folding frequency. g) h) Folding results in distortion of the frequency response and should be minimized by proper choice of the sampling frequency or filtering. Frequency Response of a Digital System. 17 Spectrum of Sampled Waveform 18 MATLAB Commands Calculate & plot frequency response of DT system • Spectrum of sampled waveform = periodic function of with period is a real valued function 1) Magnitude = even function of frequency 2) Phase = odd function of frequency Sampling period T = 0.2 s >> z=tf('z',0.2)% Define operator z >> g= 0.1*(z–0.01)/(z–0.05) % Transfer function >> z1= 0.1+j*0.1 >> f_resp = evalfr(g,z1) % Evaluate at z=z1 >> H = freqresp(g,w) % Evaluate at freq. grid w 19 20 Frequency Response Plots MATLAB Plots >> bode( g) >> nichols( g) w = frequency grid, use w not wT as in evalfr >> [Magnitude, Phase, w] = bode(g) % Bode data >> [Real, Imag] = nyquist(g, w) % Nyquist data Output: multidimensional array >> mag=reshape(Magnitude,1, length(w)); >> plot(w, mag) >>plot(w, Magnitude(:) ) Several Plots on One Page >> subplot(2, 3, 4) % rows, columns, order i) creates a 2-row, 3-column grid ii) draw axes at the first position of the second row (the first three plots are in the first row) Next, plot command uses axes >> bode(g) % Bode plot in location (2,3,4) 21 22 The Sampling Theorem The Sampling Theorem Theorem 2.4 The band-limited signal F can be reconstructed from the discrete-time waveform ∗ Two different waveforms with identical samples. if and only if • Use an ideal low pass filter of bandwidth 23 24 Proof Ideal LPF • Unit impulse train and its Fourier transform F For a band-limited signal, the amplitude and phase in the frequency range 0 to can be recovered by an ideal low-pass filter. • Impulse sampling: multiply waveform by • Spectrum of product: convolution of two spectra. F 25 26 Finite Bandwidth Approximation Finite Bandwidth • Idealization associated with infinite duration. • Finite duration implies infinite bandwidth. Why? Band limiting: equivalent to multiplication by a pulse in the frequency domain. Convolution Theorem: multiplication in the frequency domain convolution of the inverse Fourier transforms. • Inverse transform of a band-limited function = convolution of the original time function with the sinc function, a function of infinite duration. 27 Time-limiting: pulse function of infinite duration . Frequency Convolution: time multiplication is equivalent to convolution of Fourier transforms. Spectrum of time-limited function = convolution of its spectrum with a sinc function (infinite BW). Spectrum of a time limited function: infinite BW. Measurements over a finite time period: infinite BW. Treat physical signals as band-limited: negligible spectral components beyond "effective bandwidth“. Choose a suitable sampling rate using the sampling theorem. 28 Choice of Sampling Rate Limitations 1. Sampling frequency upper bounded = sensor delay. Example: oxygen sensors used in automotive air/fuel ratio control have a sensor delay of about 20 ms. 2. Computational time needed to update the control (less restrictive with the availability of faster microprocessors). 3. Sampling fast enough to provide a good representation of the analog physical variables. • Lower bound specified in sampling theorem. • Rule of thumb: choose • Constant depends on the application. 29 Linear System 30 Second Order System Output spectrum=frequency response input spectrum • Input is not known a priori base our choice of sampling frequency on the frequency response. • First order system • K = DC gain, • BW of the system is approximated by • Choose sampling frequency = system bandwidth • Choose sampling frequency (assume ) • Step response of a second order system includes 31 32 Example 2.24 Example 2.23 • Design a closed-loop control system • Design Specs.: For a signal of bandwidth 10 rad/s, select a suitable sampling frequency and find the corresponding sampling period. Solution: • Choose sampling frequency rad/s. • The corresponding sampling period – Steady-state error – Damping ratio – Undamped natural frequency • Select a suitable sampling period for the system if the system has a sensor delay of (a) 0.005 s (b) 0.02 s. 33 Solution Sampling period (a) Sensor delay=0.005 s Choose (b) s. s > sensor delay. Sensor delay=0.02 s Choose s = sensor delay. 35 34