Lecture 24 Introduction to Discrete Time Systems and Their Analog Counterparts

Total Page:16

File Type:pdf, Size:1020Kb

Lecture 24 Introduction to Discrete Time Systems and Their Analog Counterparts

1

Lecture 24 Introduction to Discrete Time Systems and Their Analog Counterparts

Motivation Continuous-time (i.e. analog) systems are fundamental to understanding feedback control. However, rarely are analog controllers implemented to control analog plants. A discrete-time (i.e. digital) controller is a computer algorithm. Unlike an analog controller, a digital controller requires an analog-to-digital converter (A/D) to convert voltages into numbers, and a digital-to-analog converter (D/A) to convert numbers into voltages. However, the disadvantages of this additional hardware are offset by the advantages offered by the ease with which more advanced controllers can be implemented.

The Mathematics of Going from Continuous to Discrete Time

A continuous time function  (N ,N ) with t [0,) that is sampled every T seconds results is a discrete time function f (kT) , where k {0,1,⋯,}. The parameter T is called the sampling interval, or the sampling period. Its units (unless otherwise stated) are [seconds/sample]. The parameter s  2 /T is, therefore, the sampling frequency, with units [rad/sec].

at a(kT )   Example 1 Consider f (t)  e . Then f (kT)  e . Define   ea T . Then we can write f (kT)   k  f (k) , where the defined equality at right is often used for notational convenience. As simple as this may seem, there are a number of differences between f (t) and f (k) .

Difference #1: By sampling, we no longer have any information about f (t) at times other than the sample times. It could be doing all manner of crazy things!

Difference #2: The frequency structure of f (t) extends over all frequencies  (,) , whereas the frequency structure

 of f (k) is defined only over  ( , ) , where is called the Nyquist frequency. To see why this is N N N s / 2   /T

 so, recall that F(s)   f (t)est dt is the Laplace transform of f (t) . A natural approximation of this integral for f (k) is 0   s(kT ) s    i sT ( i )T T iT F(s)   f (kT )e T . For any , we have e  e  e e . Let s'   i' where '   ms for any k 0

s'T ( i')T T i(s ) sT s'T integer m. Then e  e  e e  e . In words, e is a periodic function of  , with period s . Hence, f (k) is uniquely defined over the fundamental period  (N ,N ) .

 at One might expect that in the region  (N ,N ) , F(i)  F(i) . Sadly, this is almost never the case. For f (t)  e , we a have F(s)  ; consequently, s  a a F(i)  . (1a) a  i

     k k 1 k T sT F(s)  T  z  T ( z )  We will now drive the expression for F(i) . To this end, define z e . Then   1 k 0 k 0 1 z This power series expression requires that | z 1 |1. We will assume, for now, that this inequality holds. Then, for s  i , z  eiT . Hence, 2

 T T F(i)  iT  . (1b) 1e [1 cos(T)] i sin(T)

Clearly, (1a) and (1b) are not equal. To see more clearly how they differ, we will look at the differences in their magnitude and phase. The magnitude of (1a) is: a M () | F(i) | . (2a) a2  2

  T T Similarly, M () | F(i) |  . (2b) [1 cos(T)]2 [ sin(T)]2 (1)2  2 cos(T)

The phase of (1a) is:  ()   tan 1( / a) . (3a)

 Similarly,  (i)   tan 1{ sin(T ) /[1 cos(T)]}. (3b)

To illustrate these differences graphically, let a 1, and let s  10 . We will compute and overlay (2) and (3) over the frequency range  [0.01,100] .

M and Mhat 5

0

-5

-10

-15

B -20 d

-25

-30 -35  ( , ) -40 N N -45 10-2 10-1 100 101 102 Frequency (r/s)  Figure 1 Comparison of magnitudes (LEFT) and phases (RIGHT) related to F(i) and F(i) for a 1, and let s  10 . 3

Matlab Code %PROGRAM NAME: lec24.m %Example 1 a=1; ws=10; T=2*pi/ws; aa=exp(-a*T); w=logspace(-2,2,500); F=a*(a+1i*w).^-1; MdB=20*log10(abs(F)); TH=angle(F)*(180/pi); Fhat=T*(1-aa*cos(w*T) +1i*aa*sin(w*T)).^-1; MhatdB=20*log10(abs(Fhat)); THhat=angle(Fhat)*(180/pi); figure(1) semilogx(w,MdB) hold on semilogx(w,MhatdB,'r') title('M and Mhat') xlabel('Frequency (r/s)') ylabel('dB') grid figure(2) semilogx(w,TH) hold on semilogx(w,THhat,'r') title('TH and THhat') grid xlabel('Frequency (r/s)') ylabel('Degrees')

Recommended publications