ECE 308 -2 ECE 308 Continuous-Time and Discrete-Time Signal Sampling of Analog Signals Z. Aliyazicioglu Electrical and Computer Engineering Department Cal Poly Pomona ECE 308-2 1 Continuous Time Signal Let’s have the following continuous-time sinusoidal signal: xa (t ) = A cos(Ωt + θ ), − ∞ < t < ∞ where A: the amplitude of the signal Ω: the frequency in radians per second θ: the phase in radians The frequency can be expressed in cycles/s or Hertz (Hz) F= Ω 2π The period is define as Tp = 1 F ECE 308-2 2 1 Continuous Time Signal Tp A θ The analog sinusoidal signal can repeat every period xa (t + Tp ) = xa (t ) • Increasing the frequency means decreasing the period of the signal, so that increase the rate of oscillation of the signal ECE 308-2 3 Continuous Time Signal The analog sinusoidal signal can be expressed in complex exponent for as xa (t ) = A cos(Ωt + θ ) = A j ( Ωt +θ ) A − j ( Ωt +θ ) e + e 2 2 Im Ω A/2 Ωt+θ Re Ωt+θ A/2 Ω ECE 308-2 4 2 Discrete-Time Sinusoidal Signal A discrete-time sinusoidal signal may be expressed as x(n) = A cos(ω n + θ ), − ∞ < n < ∞ where n : integer variable A : the amplitude of the signal ω : the frequency in radians per sample θ : the phase in radians The frequency can be expressed in cycles per sample f = ω 2π and the signal is x(n) = A cos(2π fn + θ ), − ∞ < n < ∞ ECE 308-2 5 Discrete-Time Sinusoidal Signal Example: A sinusoidal signal with the amplitude A, frequency ω=π/6 radians per sample (f=1/12) and phase θ=π/3 x(n) …… n A discrete-time sinusoidal is periodic only if its frequency is rational number x(n + N ) = x( n) cos[2π f 0 ( N + n) + θ ] = cos[2π f 0 n + θ ] It is true if and only if 2π f 0 N = 2kπ or f0 = k / N ECE 308-2 6 3 Discrete-Time Sinusoidal Signal Discrete-time sinusoids whose frequencies are separated by an integer multiple of 2π are identical cos[(ω 0 + 2π ) n + θ ] = cos(ω 0 n + 2π n + θ ) = cos(ω 0 n + θ ) xk (n ) = A cos(ω k n + θ ) = A cos[(ω0 + 2kπ )n + θ ], for k = 0,1,2... are identical and where −π ≤ ω0 ≤ π The highest rate of oscillation in a discrete-time sinusoidal is attained when ω=π (or ω=-π) equivalent to f=1/2 (or f=-1/2) x(nFor ) = A cos ω 0 n ω 0 π/8 π/4 π/2 π f 0 1/16 1/8 1/4 1/2 N ∞ 16 8 4 2 ECE 308-2 7 Discrete-Time Sinusoidal Signal If π ≤ ω0 ≤ 2π , it creates an aliasing. How? Let’s ω1 = ω 0 which π ≤ ω 0 ≤ 2π and ω 2 = 2π − ω 0 which π ≤ ω0 ≤ 2π x1 (n) = A cos ω1n = A cos ω 0 n x2 (n) = A cos ω 2 n = A cos(2π − ω 0 )n = A cos ω 0 n = x1 (n) Hence, ω 2 is an alias of ω1 . ECE 308-2 8 4 Analog-to-Digital Conversion (ADC) • In many real-world application, the signals are analog. • To process analog signal by digital, we need to convert them into digital signal • This process is called Analog-to-Digital conversion and devices are A/D Converter (ADCs). • A/D Conversion has three steps: xa(t) Sampler Analog Signal Sampling : x(n) Quantizer Discrete-Time Signal xq(n) Coder Quantized Signal Digital Signal • Conversion of a continuous-time signal into a discrete-time signal • Taking “samples” of the continuous-time signal at discrete-time instants. x(n) = xa ( nT ) • Sampling interval is T. ECE 308-2 9 Analog-to-Digital Conversion (ADC) 2. Quantization: • Conversion of a discrete-time continuous valued signal into a discrete-time, discrete valued digital signal xq (n) Digital signal values are a finite set of possible values. The differences between xq ( n) and x( n) ( xq (n) − x(n) ) is called the quantization error. Discrete–time Signals are defined only at certain specific values of time or variable. • • • 3. Coding: • Each discrete value is represented by a b-bit binary sequence. ECE 308-2 10 5 Sampling of Analog Signals Analog Signal xa(t) x(n)=xa(nT) Discrete-time Signal Fs=1/T >> x=0:0.1:10; >> y=x.^3-18*x.^2+81*x; >> plot(x,y) >> x=0:10; >> y=x.^3-18*x.^2+81*x; >> stem(x,y) ECE 308-2 11 Sampling of Analog Signals The discrete-time signal x(n) is obtained by “taking-samples” of the analog signal xa (t ) every T second. x ( n) = xa ( nT ) The time interval T is called the sampling period or sampling interval The sampling rate or the sampling frequency is found as Fs = 1 [ Hz ] T The relationship between the variable t of analog signal and the variable n of discrete-time signal is t = nT = n Fs ECE 308-2 12 6 Sampling of Analog Signals Consider an analog sinusoidal signal xa (t ) = A cos(2π Ft + θ ) Sampling frequency is Fs = 1/ T , so that x( n) = xa (nT ) = A cos(2π FnT + θ ) = A cos(2π F n +θ ) Fs x(n) = A cos(ω n + θ ) or f = We call relative or normalize frequency that Equivalently, ω= F Fs 2π F Ω = = ΩT Fs Fs ECE 308-2 13 Sampling of Analog Signals Relations between analog signals and Discrete-time signal Continuous-time signal Discrete-time signal ω = 2π f ω [radians/sample] Ω = 2π F f [cycles/sample] Ω [radians/s] F [Hz] Range −∞ < Ω < ∞ ω =ΩT , f = F / Fs −π ≤ ω ≤ π 1 2 − ≤f≤ Ω =ω /T , F = f .Fs 1 2 Range − −∞ < F < ∞ − π T ≤Ω≤ π T Fs F ≤F≤ 2 2 2 ECE 308-2 14 7 Sampling of Analog Signals The fundamental different between analog signal and discrete-time signal is frequency range. The highest frequency in the discrete-time signal is ω = π or , f = 1/ 2 the sampling rate Fs , the corresponding highest value of F and are Fmax = Example: Fs 1 = 2 2T Ω max = π Fs = Ω π T Consider two analog signal x1 (t ) = cos 2π 10t x2 (t ) = cos 2π 50t The sampling rate is Fs = 40Hz Find discrete time signal x1(n) and x2(n) ECE 308-2 15 Sampling of Analog Signals Example:(cont) Corresponding discrete-time signals are π 10 x (n) = cos 2π n = cos n 40 2 5π 50 x(n) = cos 2π n = cos n 2 40 We know that cos Hence 5π π π n = cos 2π + n = cos n 2 2 2 x1 (n) = x2 (n) The frequency F2 = 50Hz is an alias of the frequency F1 = 10Hz at the sampling rate of Fs = 40 Hz. Even Fk = ( F1 + 40 k ), k = 1,2,3,... are alias of F1 at the sampling rate at Fs = 40 Hz. ECE 308-2 16 8 Sampling of Analog Signals In general form, Fk = ( F0 + kFs ), k = ±1, ±2, ±3,... are creates an alias for frequency F0 of analog signal, which are outside of − Fs F ≤F≤ 2 2 2 ECE 308-2 17 Sampling of Analog Signals F=10 Hz F=50 Hz T=0.025 s >> t=0:0.001:0.2; >> x1=cos(2*pi*10*t); >> plot (t,x1,'--') >> hold on >> x2=cos(2*pi*50*t); >> plot (t,x2,'r--') >> n=0:0.025:0.2; >> y1=cos(2*pi*10*n); >> stem (t,y1,'g-') >> Title('Discrete-time signal with x1(t) and x2(t)') Fs=40 Hz ECE 308-2 18 9