Lecture 4: Sampling and Reconstruction Data Reconstruction (Hold) Reading: Chapter 3 of the textbook TexPoint fonts used in EMF. Read the TexPoint manual before you delete this box.: AAAAAAAAAAAAAA
A Typical Digital Control System Sampling Reconstruction continuous-time signal discrete-time system continuous-time system 𝑇 𝑟(𝑡) A/D Computer D/A Data Hold Plant 𝑦(𝑡) _ 𝑒(𝑡) discrete-time signal digital signal discrete-time signal continuous-time signal Sensor Sampling and data reconstruction needed to interface the digital computer with the physical world Sampling Continuous-time Signals Discrete-time Signals Data reconstruction
Sampler A sampler obtains from a continuous-time signal a discrete-time signal by sampling every 𝑇 seconds Input is a continuous-time signal 𝑒 𝑡 , 𝑡≥0 Output is a discrete-time signal 𝑒(𝑘𝑇), 𝑘=0,1,… Both signals have identical values at sampling moments Not a lossless procedure Not a time-invariant procedure 𝑒(𝑡) 𝑒(𝑘𝑇) 𝑇 𝑒(𝑡) 𝑒(𝑘𝑇) ⋯ 𝑇 2𝑇 3𝑇 4𝑇 𝑡
A/D Converter (ADC) (From Wikipedia: 4-channel stereo multiplexed analog-to-digital converter WM8775SEDS made by Wolfson Microelectronics placed on a X-Fi Fatal1ty) Pro sound card.
Reconstruction: Zero-Order Hold Data reconstruction needed to convert digital controller output into a continuous-time signal to drive the plant Ideally both signals should agree at the sampling moment: 0, 𝑇, 2𝑇, … The simplest data reconstruction is zero-order hold Given a discrete time signal 𝑒(𝑘𝑇), 𝑘=0,1,… A continuous-time signal 𝑒 𝑡 , 𝑡≥0, is reconstructed whose value at any time 𝑡 is equal to the value of 𝑒(𝑘𝑇) in the closest sampling moment preceding 𝑡:
D/A Converter (DAC) AK4396 DAC for Headphone Output (from www.ikalogic.com) An 8-Digit DAC implemented by R/2R resistor network From Wikipedia: 8-channel digital-to-analog converter Cirrus Logic CS4382 as used in a soundcard.
Sampled-Data Control System 𝑒(𝑘𝑇) 𝑢(𝑘𝑇) 𝑢(𝑡) 𝑒(𝑡) Digital controller Plant 𝑦(𝑡) Sampler Data hold _ Does there exist a transfer function from 𝑒(𝑡) to 𝑢(𝑡)? What about from 𝑒(𝑘𝑇) to 𝑢(𝑘𝑇)? Let us start from the simplest case: digital controller does nothing 𝑒(𝑡) 𝑒 (𝑡) 𝑒(𝑘𝑇) Sampler Data hold sampler and hold
Sampler and Zero-Order Hold What is the effect of sampler and hold in frequency domain? 𝑒(𝑡) 𝑒 (𝑡) 𝑒(𝑘𝑇) Sampler Data hold 𝐸(𝑠) 𝐸(𝑧) 𝐸 (𝑠) 𝑒 (𝑡) 𝑒(𝑡) ⋯ 𝑇 2𝑇 3𝑇 4𝑇
Sampler and Zero-Order Hold Laplace transform of 𝑒(𝑡): 𝐸 𝑠 =ℒ[𝑒 𝑡 ] 𝑧-transform of 𝑒(𝑘𝑇): 𝐸 𝑧 = 𝑘=0 ∞ 𝑒 𝑘𝑇 𝑧 −𝑘 Laplace transform of 𝑒 𝑡 : 𝑒 𝑡 =𝑒 0 1 𝑡 −1 𝑡−𝑇 +𝑒 𝑇 1 𝑡−𝑇 −1 1−2𝑇 +⋯ = 𝑘=0 ∞ 𝑒 𝑘𝑇 𝑒 −𝑘𝑇𝑠 ⋅ 1− 𝑒 −𝑇𝑠 𝑠 Independent of signal 𝑒(𝑡) 𝐸 ∗ 𝑠 =𝐸 𝑧 𝑧= 𝑒 𝑇𝑠 𝑒 (𝑡) 𝑒(𝑘𝑇) ⋯ 𝑇 2𝑇 3𝑇 4𝑇
Sampler and Zero-Order Hold (cont.) Sampler and zero-order hold can be broken up in two steps: 𝐸 𝑠 𝑇 𝐸 ∗ 𝑠 𝐸 𝑠 𝐺 ℎ0 𝑠 = 1− 𝑒 −𝑇𝑠 𝑠 Ideal sampler 0-th order data hold 𝐸 ∗ 𝑠 =𝑒 0 +𝑒 𝑇 𝑒 −𝑇𝑠 +𝑒 2𝑇 𝑒 −2𝑇𝑠 +⋯ In time domain: 𝑇 𝑒 𝑡 𝑒 ∗ 𝑡 𝑒 𝑡 𝑇 where 𝑒 ∗ 𝑡 is a string of impulses whose amplitudes are modulated by 𝑒(𝑡): 𝑒 ∗ 𝑡 =𝑒 0 𝛿 𝑡 +𝑒 𝑇 𝛿 𝑡−𝑇 +𝑒 2𝑇 𝛿 𝑡−2𝑇 +⋯
Ideal Sampler 𝑒 ∗ 𝑡 =𝑒 0 𝛿 𝑡 +𝑒 𝑇 𝛿 𝑡−𝑇 +𝑒 2𝑇 𝛿 𝑡−2𝑇 +⋯ 𝑒 𝑡 𝑒 ∗ 𝑡 𝑒 ∗ 𝑡 =𝑒 0 𝛿 𝑡 +𝑒 𝑇 𝛿 𝑡−𝑇 +𝑒 2𝑇 𝛿 𝑡−2𝑇 +⋯ =𝑒 𝑡 ⋅[𝛿 𝑡 +𝛿 𝑡−𝑇 +𝛿 𝑡−2𝑇 +⋯] 𝛿 𝑇 𝑡 𝛿 𝑇 𝑡 𝛿 𝑇 𝑡 is a string of unit impulses T seconds apart: 𝛿 𝑇 𝑡 𝑇 2𝑇 3𝑇 4𝑇 𝑒 𝑡 𝑒 ∗ 𝑡 Impulse Modulator
Remarks on Ideal Sampler Not a physical entity (introduced for theoretical convenience) Linear but not time-invariant, cannot be modeled by a transfer function Can map different 𝑒(𝑡) to the same 𝑒 ∗ (𝑡) If 𝑒(𝑡) is discontinuous at a sampling time 𝑘𝑇, choose If 𝑒(𝑡) has impulses at sampling times, then 𝑒 ∗ 𝑡 is not well defined 𝑒 ∗ 𝑡 =𝑒 0 + 𝛿 𝑡 +𝑒 𝑇 + 𝛿 𝑡−𝑇 +⋯
Sampler and Hold: First Perspective In the time domain: 𝑇 𝑒(𝑡) 𝑒(𝑘𝑇) 𝑒 (𝑡) Zero-Order Hold Sampler In the frequency domain (a mixture of z- and Laplace transforms): 𝑇 𝐸 𝑠 𝐸 𝑧 𝐸 𝑠 Zero-Order Hold Sampler 𝐸 𝑧 = 𝑘=0 ∞ 𝑒 𝑘𝑇 𝑧 −𝑘 is called the z-transform of 𝐸(𝑠)
Sampler and Hold: Second Perspective In the time domain: 𝑇 𝑒(𝑡) 𝑒 ∗ (𝑡) 𝑒 (𝑡) Ideal sampler Data hold In the frequency domain: 𝑇 𝐸 𝑠 𝐸 ∗ 𝑠 𝐸 𝑠 𝐺 ℎ0 𝑠 = 1− 𝑒 −𝑇𝑠 𝑠 𝐸 ∗ 𝑠 = 𝑘=0 ∞ 𝑒 𝑘𝑇 𝑒 −𝑘𝑇𝑠 is called the star-transform of 𝐸(𝑠)
Relating the Two Perspectives 𝐸(𝑧) sampler z-transform 𝐸 ∗ 𝑠 =𝐸 𝑧 𝑧= 𝑒 𝑇𝑠 𝐸(𝑠) 𝐸 (𝑠) Ideal sampler Zero-order hold star transform 𝐺 ℎ0 𝑠 = 1− 𝑒 −𝑇𝑠 𝑠 𝐸 ∗ (𝑠)
Finding Star-Transform of 𝐸(𝑠) Given E(s), find Approach I: If 𝐸 𝑠 is a rational function (and …), then where the summation is over all poles of E(¸) Approach II: (see Appendix III) where 𝜔 𝑠 = 2𝜋 𝑇 is called radian sampling frequency 𝐸 ∗ 𝑠 = 𝑘=0 ∞ 𝑒 𝑘𝑇 𝑒 −𝑘𝑇𝑠 𝐸 ∗ 𝑠 = [𝑟𝑒𝑠𝑖𝑑𝑢𝑒 𝑜𝑓 𝐸 𝜆 1 1− 𝑒 −𝑇(𝑠−𝜆) ] 𝐸 ∗ 𝑠 = 1 𝑇 𝑘=−∞ ∞ 𝐸 𝑠+𝑗𝑘 𝜔 𝑠 + 𝑒(0) 2
Finding 𝑧-Transform of 𝐸(𝑠) Given E(s), find Approach I: If 𝐸 𝑠 is a rational function (and …), then Approach II: find 𝐸 ∗ (𝑠) first, then Approach III: consult the 𝑧-transform table on pp. 676 𝐸 𝑧 = 𝑘=0 ∞ 𝑒 𝑘𝑇 𝑧 −𝑘 𝐸 𝑧 = [𝑟𝑒𝑠𝑖𝑑𝑢𝑒 𝑜𝑓 𝐸 𝜆 1 1− 𝑧 −1 𝑒 𝑇𝜆 ] 𝐸 𝑧 = 𝐸 ∗ 𝑠 𝑒 𝑇𝑠 →𝑧
Examples 𝐸 𝑠 = 1 𝑠 𝐸 𝑠 = 1 𝑠+2
Example 𝐸 𝑠 = 1 𝑠+𝑎 2 𝐸 𝑧 = 𝑇𝑧 𝑒 −𝑎𝑇 𝑧− 𝑒 −𝑎𝑇 2 𝐸 𝑠 = 1 (𝑠+1)(𝑠+2) 𝐸 𝑠 = 1 𝑠+𝑎 2 𝐸 𝑧 = 𝑇𝑧 𝑒 −𝑎𝑇 𝑧− 𝑒 −𝑎𝑇 2 𝐸 𝑠 = 1 (𝑠+1)(𝑠+2) 𝐸 𝑠 = 𝜔 2 𝑠 2 + 𝜔 2 𝐸 ∗ 𝑠 = 𝑒 −𝑇𝑠 sin 𝜔𝑇 1−2 𝑒 −𝑇𝑠 cos 𝜔𝑇 + 𝑒 −2𝑇𝑠
Effect of Time Delay on Star-Transform If 𝑡0=𝑛𝑇 is an integer multiple of the sampling period 𝑇, then For general 𝑡0, the above is not true 𝐸 ∗ 𝑠 = 𝑒 −𝑛𝑇𝑠 𝐸 1 ∗ 𝑠
Periodicity Property of 𝐸 ∗ (𝑠) 𝐸 ∗ (𝑠) is periodic in 𝑠 with period 𝑗 𝜔 𝑠 =𝑗 2𝜋 𝑇 𝐸 ∗ 𝑠+𝑗𝑚 𝜔 𝑠 = 𝐸 ∗ (𝑠) for integer 𝑚
Strings of Poles of 𝐸 ∗ (𝑠) If 𝐸(𝑠) has a pole at 𝑝, then 𝐸 ∗ (𝑠) has poles at 𝑝±𝑗𝑚 𝜔 𝑠 𝐸 ∗ (𝑠) 𝐸(𝑠) 𝑗 𝜔 𝑠 2 × × × Primary strip − 𝑗 𝜔 𝑠 2 ×
Data Reconstruction
Sampler and Hold: Second Perspective In the time domain: 𝑇 𝑒(𝑡) 𝑒 ∗ (𝑡) 𝑒 (𝑡) Ideal sampler Data hold In the frequency domain: 𝑇 𝐸 𝑠 𝐸 ∗ 𝑠 𝐸 𝑠 𝐺 ℎ0 𝑠 = 1− 𝑒 −𝑇𝑠 𝑠
Data Reconstruction in Frequency Domain 𝑒(𝑡) 𝑒 ∗ (𝑡) 𝑒 (𝑡) 𝐸(𝑗𝜔) 𝐸 ∗ (𝑗𝜔) 𝐸 (𝑗𝜔) Ideal sampling Data reconstruction 𝐸 ∗ 𝑗𝜔 = 1 𝑇 𝑘=−∞ ∞ 𝐸 𝑗𝜔+𝑗𝑘 𝜔 𝑠 + 𝑒(0) 2 𝐸 𝑗𝜔 = 𝐺 ℎ0 𝑗𝜔 𝐸 ∗ (𝑗𝜔) (periodic extension in freq. domain) (data hold transfer function) Shannon’s Sampling Theorem: 𝑒(𝑡) can be uniquely reconstructed from 𝑒 ∗ (𝑡) if 𝐸(𝑗𝜔) has no frequency component greater than 𝜔 𝑠 2 = 𝜋 𝑇 Need to sample at least twice as fast as the highest frequency in 𝐸(𝑗𝜔) Perfect reconstruction by the ideal low pass filter (physically infeasible)
Zero-Order Hold A physically feasible (causal) data hold transfer function is Frequency (magnitude) response 𝐺 ℎ0 𝑠 = 1− 𝑒 −𝑇𝑠 𝑠 1 with impulse response 𝑇 |𝐺 ℎ0 𝑗𝜔 |= 1− 𝑒 −𝑗𝜔𝑇 𝑗𝜔 =𝑇 sin 𝜋𝜔 𝜔 𝑠 𝜋𝜔 𝜔 𝑠
First-Order Hold Idea: Given the sampled data 𝑒 𝑘𝑇 , 𝑘=0,1,…, reconstruct the signal between sampling times by extrapolating two previous data 𝑒 𝑡 =𝑒 𝑘𝑇 + 𝑒 𝑘𝑇 −𝑒 𝑘−1 𝑇 𝑇 𝑡−𝑘𝑇 , 𝑘𝑇≤𝑡< 𝑘+1 𝑇 First-order hold is causal
Transfer Function of First-Order Hold Impulse response 2 1 2𝑇 𝑇 −1 ℎ 𝑡 =1 𝑡 + 𝑡 𝑇 ⋅1 𝑡 −2⋅1 𝑡−𝑇 − 2 𝑡−𝑇 𝑇 1 𝑡−𝑇 +1 𝑡−2𝑇 + 𝑡−2𝑇 𝑇 ⋅1 𝑡−2𝑇 ⇒ 𝐺 ℎ1 𝑠 = 1+𝑇𝑠 𝑇 1− 𝑒 −𝑇𝑠 𝑠 2
Fractional-Order Holds 𝑒 𝑡 =𝑒 𝑘𝑇 +𝜂 𝑒 𝑘𝑇 −𝑒 𝑘−1 𝑇 𝑇 𝑡−𝑘𝑇 , 𝑘𝑇≤𝑡< 𝑘+1 𝑇 where the parameter 𝜂∈[0,1] Impulse response 2 1 2𝑇 𝑇 −1 𝐺 ℎ𝜂 𝑠 = 1−𝜂 𝑒 −𝑇𝑠 1− 𝑒 −𝑇𝑠 𝑠 + 𝜂 𝑇 𝑠 2 1− 𝑒 −𝑇𝑠 2