COMP 40420 2. Signals and Systems Dr Chris Bleakley UCD School of Computer Science and Informatics. Scoil na Ríomheolaíochta agus an Faisnéisíochta UCD.
Introduction 1. Signals 2. Systems 3. System response 4. Recursive systems 5. Noise 2
Deterministic and random A deterministic signal is one which can be uniquely described by an explicit mathematical expression, a table of data, or a well-defined rule. A random signal is one which cannot be described to any reasonable degree of accuracy by explicit formulae, data tables or rules or for which such a description is too complicated to be of any practical use. I.e. the signals evolve in an unpredictable manner. 3
Signals Unit sample signal (a.k.a. impulse or Dirac pulse or delta function) Unit step signal 4
Signals So what are real-world signals like? A lot of signals are produced by oscillations, e.g. Tuning fork Plucked string The signals propagate (travel) as waves, e.g. Sound is a pressure wave propagating through air How to describe these signals? 5
Signals Displacement Phase Period Frequency=1/Period Amplitude Time 6
Signals The amplitude of a waveform is the maximum displacement from rest. (mm) The period of a repeating waveform is the time duration of single cycle. (seconds) The frequency of a repeating waveform is the number of cycles per second. (Hz) Hertz (Hz) is defined as the number of cycles per second. Phase is the fraction of a complete cycle by which a periodic waveform is offset at time zero (t=0). (radians) 7
Signals A body will oscillate in simple harmonic motion if it is displaced from rest and experiences a restoring force which is proportional to the displacement, e.g. Hooke's Law for a mass on a spring. If you solve the equations of motion, the displacement x a at any time t is given by: where [Wikipedia] 8
Signals The shadow of circular motion... [Wikipedia] 9
Signals The shadow of circular motion... t A - ϕ x + 10
Signals The shadow of circular motion... Angle in radians: 0 rads = 0 degrees π/2 rads = 90 degrees π rads = 180 degrees 2π rads = 360 degrees t - A ϕ x + cos( θ) = adjacent hypotenuse x = Acos( φ) ( t) = Acos( 2πFt) x a x a ( t) = Acos 2π 1 t T p x a ( t) = Acos 2π 1 t + θ T p 11
Signals Displacement, xa(t) Phase, θ Period, T Frequency, F=1/T Amplitude, A Time, t 12
Signals f = 1 T A = 1; f = 1 25 ;θ = 0 A = 1; f = 1 25 ;θ = π A = 10; f = 1 25 ;θ = 0 A = 1; f = 1 50 ;θ = 0 13
Pop Quiz Sketch the following: ( ) = 30 cos( 2π 5t) ( ) = 30 cos( 2π 5t + π 2) ( ) = 10cos( 2π 2t + π ) ( ) = 10cos( 2π 2t + π ) + 3 ( ) = 10cos( 2π 2t + π ) x t x t x t x t x t Are these signals deterministic or random? 14
Discrete Time Replace time, t, with sample number n. Replace frequency in Hertz (cycles per second), F, with normalized frequency f (cycles per sample). Need to know how many sampling frequency, fs. f = F f s = Ft s 15
Discrete Time Sometimes people merge the terms, but using Normalized frequency ω (radians per sample) x( n) = Acos( 2π fn + θ) ω = 2π f x( n) = Acos( ωn + θ) 16
Pop Quiz Sketch the following: ( ) = 5cos( 2πn 4) ( ) = 2 cos( 2πn 16 + π 4) ( ) = 3cos( ωt) where ω = 2πn 10 ( ) = 3cos( 2π ft) where f = n 5 x n x t x t x t Are these signals deterministic or random? 17
Signals So what does these frequencies mean? [podcomplex.com] 18
Signals Range of human hearing [dvd-hq.info] 19
Signals So then we can synthesis cosine waves at those frequencies to make pure tones. fs=44100; bits=16; L=2*fs; f=261.63; n=[0:l-1]; x=0.9.*cos(2.*pi.*f.*n./fs); r = randn(1,l); y = 0.7*x+0.1*r; sound(y,fs,bits); 20
Signals Harmonics The fundamental frequency is the lowest frequency in a harmonic series. A harmonic is a component frequency of a signal that is an integer multiple of the fundamental frequency. If the fundamental frequency is f, the harmonics are 2f,3f,4f,... The harmonics are all periodic at the fundamental frequency so the sum of the harmonics is also periodic that the fundamental frequency. On a musical scale, one octave up is double the frequency. So, C5 is harmonic with C4. 21
Signals Vuvuzela Fundamental B flat 3 at 233 Hz Harmonics at 470, 700, 940, 1171, 1400 and 1630 Hz fs=44100;bits=16; L=2*fs; n=[0:l-1]; har=7; f=[233 470 700 940 1171 1400 1630]; a=[0.25 0.1125 0.1 0.075 0.05 0.025 0.025]; x = zeros(l,har); for ind=1:har, x(:,ind)=a(ind).*cos(2.*pi.*f(ind).*n./fs); end y = sum(x,2); sound(y,fs,bits); 22
Terminology A real valued signal x(n) is symmetric if 23
Manipulation x(n) Z -3 y(n) x(n) x A y(n) 24
Manipulation x 1 (n) x 2 (n) + y(n) x 1 (n) x 2 (n) x y(n) 25
Manipulation 26
Systems A system is a physical device that performs an operation on a signal. The system responds to a stimulus and generates a signal. The stimulus plus system is called a signal source. Example: Speech production system 27
System Model Speech Production System The system is the vocal cavity. For voiced speech, stimulus is puffs of air coming through the vocal chords. For unvoiced speech, stimulus is turbulent air moving through a constriction. [P. Naylor, ICL] 28
System Models Real-world systems can be modeled by mathematical processing of discrete-time signals. The input signal can be transformed into the output signal using the model. x(n) Input signal or excitation Discrete-time system y(n) Output signal or response 29
System Models Why model systems? To synthesize an artificial equivalent of a real-world signal Music synthesis Speech synthesis To understand a real-world system Scientific seismic analysis To enable signal compression Voice coding Audio compression 30
System Models A note: Physical models capture the dynamics of objects: displacement, velocity, pressure, current, voltage DSP models capture the effects on the signal: abstract physically correlated but detailed physical behavior is unknown 31
Causal systems "A system is said to be causal if the output of the system at any time n depends only on present and past inputs but does not depend on future inputs." If a system does not satisfy this definition it is said to be noncausal. 32
Memory If the output of the system at time n is completely determined by the input samples in the interval from n-n to n (N 0), the system is said to have memory of duration N. If N=0, the system is called static or memory-less Otherwise, the system is called dynamic If N=, the systems is said to have infinite memory 33
Relaxed systems "A system is said to be relaxed if its output is solely and uniquely determined by the given input." 34
Linear systems Superposition principle x 1 (n) x 2 (n) a 1 x x a 2 + y(n) x 1 (n) x 2 (n) a 1 x x a 2 + y(n) 35
Linear systems Linear system properties: Scaling property. Any scaling of the input signals causes a identical scaling to the output signal Additive property. Summing the input signals and transforming the resulting signal is equivalent to transforming the input signals independently and summing the resulting signals If a relaxed system does not satisfy the superposition principal, it is called nonlinear. 36
Stable systems "An arbitrary relaxed system is said to be bounded input-bounded output (BIBO) stable if and only if every bounded input produces a bounded output." 37
This course This course focuses on: Discrete-time signals Linear Time Invariant (LTI) systems Causal systems BIBO stable systems 38
System response We can think of an arbitrary sequence as the summation of scaled and time-shifted impulses: We can denote the response of a system to unit impulse as: Assuming LTI: 39
System response Applying an arbitrary input to the system, we get: By the principle of superposition: Substituting: So, the output can be calculated as the convolutional sum of the input and system impulse response. 40
System response For causal systems with a memory of N samples system output can be calculated as: x(n) Z -1 Z -1 Z -1 h(0) x h(1) x h(2) x h(3) x h(n) + y(n) 41
Room Acoustics Example h(n) Time 42
Room Acoustics Example 43
Recursive systems Consider the cumulative average It can be calculated more efficiently using recursion 44
Recursive systems x(n) + x y(n) x n Z -1 1/(n+1) 45
Recursive systems For some systems, the calculation of some system responses may be simplified by using difference equations, in general: Where a k and b k are constant coefficients and N is the order of the system. 46
Energy and Power Signals An energy signal has finite energy (and as a consequence has zero average power). Typically, it is only non-zero is a particular time interval A power signal has finite, non-zero average power (and as a consequence infinite energy). Typically, it is non-zero at all times 47
Noise Noise is an unwanted random perturbation of a wanted signal. Any real world recording contains noise. Can be modeled as single Additive White Gaussian Noise (AWGN) source. x(n) + y(n) d(n) 48
Noise Additive means that the noise signal is added to the pure signal White means that the noise has a flat power spectrum it contains an equal mixture of all frequencies each sample is uncorrelated with all other samples Gaussian means that the probably of sample values follows a Gaussian (a.k.a. Normal) distribution with zero mean 49
Gaussian Distribution Probably Density Function is f ( x) = 1 2πσ 2 e ( x µ ) 2 2σ 2 where x = data value σ = standard deviation µ = mean [Wikipedia] 50
Noise An artificial noise signal can be synthesized using a random number generator for each sample. fs=44100; bits=16; L=2*fs; f=261.63; n=[0:l-1]; x=0.9.*cos(2.*pi.*f.*n./fs); r=randn(1,l); y=0.7*x+0.1*r; sound(y,fs,bits); 51
Noise Signal to Noise Ratio (SNR) SNR db = 10log 10 1 N 1 N N 1 n=0 N 1 n=0 x 2 r 2 ( n) ( n) 52
Recursive System + Noise example What value will the output of this calculation converge to? L = 50; x = 1+randn(1,L); y = zeros(1,l); for n=2:l, y(n) = (y(n-1).*n + x(n))./(n+1); end clf;plot(x,'r');hold on;plot(y,'b'); 53
Recursive System example 54
Summary 1. Signals 2. Systems 3. System response 4. Recursive systems 5. Noise 55