Digital Signal Processing (DSP)

Digital Signal Processing

The signals that we are trying to use may contain noises ( unwanted signals) and hence they need to be processed such as filtering the noises using the filters. Also, the information they contain can be displayed, analyzed, or converted to another type of signal. Digital Signal Processing (DSP) incorporates all these methods of processing the signals so as to retrieve the desired information from the signal. 

Signal and Systems

Signals

Signal such as sound, heartbeat, heat, earthquake, current, and more are information that get transmitted from one place to another. Systems process those signals to modify or transform them. Signal is fed into the system as time dependent input stream (x(t)) which results in output y(t) which is the response of the system. The mathematical modeling of signals and systems help in the design and development of electronic devices.

Example - Sinusoidal wave:

Consider a simple signal i.e sine wave which is the signal of Alternating Current (AC). It can be represented in mathematical term as:

x(t) = ASin(wt + Ψ),

where A is the amplitude and w is the angular frequency, Ψ is the phase angle (at time, t = 0).

Angular frequency is the rotational rate. Let’s suppose it takes time period T to complete one revolution i.e 360 degree or 2π radian, then

w = 2π/T

The ordinary frequency is the number of oscillations (cycle) in each second of time. If f is the number of oscillations in T then

f = 1/T Hz & w = 2πf

At time t, the the wave profile has angle θ degree and  θ becomes

θ = wt

Generate the Sine and Cosine signal using MATLAB script "sincos.m" as described in the section "Using HPC Cluster".

Systems

System is a device or combination of devices such as filters, amplifiers, which can operate on signals and produces corresponding response. Input to a system is called as excitation and output from it is called as response. System can be linear or nonlinear, time variant or invariant, static or dynamic, causal (depends on previous or past inputs or non-causal, invertible or non-invertible, and stable or unstable.

For more info on LTI signal, visit Appendix section.

Filters

A filter is a device or a process that removes some unwanted components or features from a signal that helps to retrieve the desired information from the signal.

Analog Filters

In an electric system, a filter (http://www.swarthmore.edu/NatSci/echeeve1/Ref/DataSheet/IntroToFilters.pdf) is a network or a system that alters the amplitude and/or phase characteristics of a signal with respect to frequency. Ideally, a filter will not add new frequencies to the input signal, nor will it change the component frequencies of that signal, but it will change the relative amplitudes of the various frequency components and/or their phase relationships. Filters are often used in electronic systems to emphasize signals in certain frequency ranges and reject signals in other frequency ranges. Such a filter has a gain which is dependent on signal frequency.

Application - FM Tuning:

When you want to listen to your FM at 89.9MHz, you tune your FM radio near it. By doing this, it allows to pass that (89.9MHz) frequency and attenuates the other frequencies so as to listen to that channel clearly without interference.

First Order RC Filter - Low Pass

Let’s build the simple filter via electric circuit using resistor and a capacitor. Having only one reactive component (capacitor), it becomes the first order or one pole (see Appendix: Poles and zeros for details) passive filter. It is a passive filter because it consumes the energy of the signal. The active filters on the other hand can amplify the signal and therefore they require external power.

Fig. 1: A simple first order Filter

Transfer Function & Gain, Frequency Response or Bode Plot:

By plotting the circuit output voltage against different values of input signal frequency, a frequency response curve or Bode plot can be obtained (see Fig. 2). The impedance of the capacitor is given by:

If the frequency is very low such as almost zero (i.e. dc current is passed), Z becomes infinite i.e capacitor acts as an open circuit and all the voltage drop occurs across the capacitor. So, output voltage is almost same as the input voltage i.e. Gain = Vout/Vin = 1 (approx). However, at higher frequency, Z gets very small and the voltage drops at resistor R. So, the output voltage is almost zero. Hence the name low pass filter i.e. passing only the lower frequency signals.

The capacitors impedance equals the resistors at cut off frequency fc, and the voltage is split between them. Each component can have 70.7% of the voltage drop instead of 50% because the maximum voltages drops are out of phase with each other by π/4 at that point. So, at cut-off frequency, the gain will be -3db (20 log (Vout/Vin)). After this cut-off frequency point, the response of the circuit decreases to zero at a slope of -20dB/ Decade (10 times increase in frequency).

In a Low Pass Filter circuit, all the frequencies below cut-off, ƒc point are unaltered with little or no attenuation and are said to be in the filters Pass bandzone. This pass band zone also represents the Bandwidth of the filter. Any signal frequencies above this point cut-off point are generally said to be in the filters Stop bandzone and they will be greatly attenuated.

As the filter contains a capacitor, the Phase Angle ( Φ ) of the output signal lags behind that of the input, and at the -3dB cut-off frequency ( ƒc ) is - 45 degree out of phase. This is due to the time taken to charge the plates of the capacitor as the input voltage changes, resulting in the output voltage (the voltage across the capacitor) “lagging” behind that of the input signal. The higher the input frequency applied to the filter, the more the capacitor lags and the circuit becomes more and more “out of phase” (see Fig. 2).

The output voltage is given by (http://www.kves.uniza.sk/kvesnew/dokumenty/DREP/Filters/352_32115_EC434_2012_4__3_1_Chapter_03.pdf):

Here, transfer function H(jw) is the gain with the complex components. Using Laplace Transform (see Appendix: Laplace Transform for details), it can be written as

The magnitude and phase of H(jw) are given by:

Where, is the filter time constant.   

Now, let’s analyze the filter in terms of

Case 3 happens at cut-off frequency (fc).

Fig. 2: Frequency Response of a 1st order Low Pass Filter (https://www.electronics-tutorials.ws/filter/filter_2.html)

Second Order RLC Filter - Band Pass

Consider RLC (Resistor, Inductor, and Capacitor) filter, i.e. second order filter as shown in fig. 3.

Fig. 3: RLC filter

The transfer function of this filter is given by:

The magnitude of the transfer function has a maximum value at a specific frequency (w0) between 0 and infinity, and falls off on either side of that frequency (see Fig. 4). The filter with this general shape is known as a band-pass filter because it passes signals falling within a relatively narrow band of frequencies and attenuates signals outside of that band.

Fig. 3: Frequency order of Band Pass RLC filter.

The range of frequencies passed by a filter i.e. the range of frequencies for which the oscillator resonates is known as the filter’s passband. The passband limits are usually assumed to be the frequencies (fl and fh) where the gain has dropped by 3 decibels i.e. 0.707 of its maximum voltage gain. Such filter response will have a peak value at center frequency (fc) which is equal to the geometric mean of fl and fh i.e.

Another quantity used to describe the performance of a filter is the filter’s ‘‘Q’’. This is a measure of the ‘‘sharpness’’ of the amplitude response given by:

Thus, a high-Q tuned circuit in a radio receiver would be more difficult to tune, but would have more selectivity as it filters out signals from other stations that lie nearby on the spectrum.

Digital Filters

A digital filter is a system that performs mathematical operations on a sampled, discrete-time signal to reduce or enhance certain aspects of that signal in contrast to analog electronic filter operating on a continuous-time analog signals.

There are two categories of digital filter: the recursive filter and the non-recursive filter. These are often referred to as Infinite Impulse Response (IIR) filters and Finite Impulse Response (FIR) filters respectively. Many digital filters are based on the fast Fourier transform, a mathematical algorithm that quickly extracts the frequency spectrum of a signal, allowing the spectrum to be manipulated before converting the modified spectrum back into a time-series signal with an inverse FFT operation. These filters give O(n log n) computational costs whereas conventional digital filters tend to be O(n2).

A recursive filter re-uses one or more of its outputs as an input. This feedback typically results in an unending impulse response characterized by either exponentially growing, decaying, or sinusoidal signal output components. . A non-recursive filter only uses input values like x[n − i], unlike recursive filter where it uses previous output values like y[n-i]. It has a finite number of coefficients in the impulse response h[n] (see Appendix: Convolution for details). Although almost all analog electronic filters are IIR, digital filters may be either IIR (e.g. Kalman Filter) or FIR. The impulse response (or response to any finite length input) of FIR is of finite duration, because it settles to zero in finite time. This is in contrast to infinite impulse response (IIR) filters, which may have internal feedback and may continue to respond indefinitely (usually decaying response). Digital IIR filters can be based on well-known solutions for analog filters such as the Chebyshev filter, Butterworth filter, and elliptic filter, inheriting the characteristics of those solutions.

The transfer function allows one to judge whether or not a system is bounded-input, bounded-output (BIBO) stable. To be specific, the BIBO stability criterion requires that the ROC (Region of Convergence) of the system includes the unit circle. For example, for a causal system, all poles of the transfer function have to have an absolute value smaller than one. In other words, all poles must be located within a unit circle in the z-plane (see Appendix: Z-Transform & Appendix: Poles and Zeros for details).

Nonrecursive Filter - FIR

Consider a 3-term moving average filter with filter coefficients given by

Where N = 2 (2nd order filter with 2 delay units) and hence bi = 1/3 as shown in the block diagram in Fig. 4.

Fig. 4: Block diagram of a 2nd order/3-tap filter implementing a moving average

The output response becomes:

Consider a finite length input sequence as shown in Fig. 5:

Fig. 5: Input sequence x[n]

Calculate the output y[n] for n=0

For the output, check "Using HPC Cluster" section. If the impulse signal (𝛿[n]) is used as input signal, then the impulse response of the filter h[n] becomes:

The transfer function in terms of z-transform becomes

Check the Appendix: Poles and zeros for the pole zero diagram and Appendix: Z-Transform for impulse response.

Stability: The system is stable as all of the poles of the system function lie inside the unit circle.

Frequency Response of the system can be found by letting z ->

The magnitude and the phase plot can be obtained using MATLAB, See the Using HPC  Cluster Section.

Application of FIR Filter

Case - Filtering Windowed Noise Sequence:

The action of moving average filter has resulted in the smoother output than the input (see Fig. 6 and Fig. 7). Let’s filter the input noise using 7-point moving average filter. We are using the same MATLAB script MovAvg.m (see Using HPC Cluster section). 

Fig. 6: Input signal or input random noise

Output y[n]:

Fig. 7: Output Response

The output is much smoother i.e noise from the signal is filtered out using the filter. 

IIR Filter

Consider a difference equation for recursive filter - IIR filter. 

For dimensions,  N=M=3, it can also be written as:

The block diagram can be drawn as shown in Fig. 8.

Fig. 8: Block diagram of Recursive filter (IIR) with z-1 time delay operator  [http://www.eas.uccs.edu/~mwickert/ece2610/lecture_notes/ece2610_chap1.pdf].

The transfer function can be written as.

The zeros and poles are shown in Fig. 9

Fig. 9: https://www.analog.com/media/en/technical-documentation/dsp-book/dsp_book_Ch33.pdf

Why high order filters?

The filter design assumes an ideal filter that has unity gain in the passband and zero gain in the stop band.

https://dsp.stackexchange.com/questions/34127/higher-order-butterworth-filters

Filter Design

Example: IIR Low Pass Filter Design [http://www.eas.uccs.edu/~mwickert/ece2610/lecture_notes/ece2610_chap1.pdf]:

Refer to Using HPC Cluster section for MATLAB commands.

Sampling

In order to process the signal through computer, the continuous signals are sampled at regular intervals (Ts) called sampling period resulting in:

s[n] = s[nTs]

The samples of a speech waverform is showed in Fig 10. 

Fig. 10: Sample of Speech Waveform [http://www.eas.uccs.edu/~mwickert/ece2610/lecture_notes/ece2610_chap1.pdf]

We need to realize that sample spacing needs to be small enough relative to the frequency such that when plotted by connecting the dots (linear interpolation), the waveform picture is not too distorted. A reasonable plot can be created with about 10 samples per period, i.e.

Refer to section Using HPC cluster for the demonstration by the plots using the MATLAB script, sampling.m.

Sampling Theorem establishes a sufficient condition for a sample rate that permits a discrete (digital) sequence of samples to capture all the information from a continuous-time (analog) signal of finite bandwidth.

Nyquist–Shannon sampling theorem: A sufficient sample-rate is therefore anything larger than 2 times B (B is the Bandwidth) samples per second of the signal. Equivalently, for a given sample rate fs, perfect reconstruction is guaranteed possible for a bandwidth. 

B < fs/2, where T = 1/fs

Fourier Series

Sinusoidal waves can be used as simple building blocks to describe and approximate any periodic waveform i.e it is the way to represent a function as the sum (superposition or linear combination) of sinusoidal waves of different amplitudes and harmonically related frequencies. Any periodic signal can be decomposed (or expanded) into the sum of a (possibly infinite) set of simple oscillating sine or cosine functions. (see Fig. 11)

Fig. 11: The Fourier series terms (in pink) gets super-positioned resulting in saw-tooth-wave (blue)

Fourier series makes use of the orthogonality relationships of the sine and cosine functions. The computation and study of Fourier series is known as harmonic analysis and is extremely useful as a way to break up an arbitrary periodic function into a set of simple terms that can be plugged in, solved individually, and then recombined to obtain the solution to the original problem or an approximation to it to whatever accuracy is desired or practical.

The synthesis equation for the Fourier series (complex version)  is given by:

Where T0 is the fundamental time period and k is the harmonic number.

The Fourier series for the function f(x) with a period 2π exists and converges to the given function if:

(i) Dirichlet integral is finite

(ii) f(x) is a single valued, piece-wise continuous (i.e. have a finite number of jump discontinuities), and piece wise monotonic (i.e. must have a finite number of maxima and minima).

The analysis equation that determines ak from x(t) is given by:

The special case, DC component (i.e. zero frequency) of x(t) is given by:

In trigonometric form, it becomes:

Where Fourier coefficients a0, an, and bn are defined by the integrals.

Example: find the Fourier series for the function :[http://www.eas.uccs.edu/~mwickert/ece2610/lecture_notes/ece2610_chap1.pdf]

Comparing this with the general Fourier series synthesis equation,

f0 = 1/T0 = 1500 Hz

The magnitude spectrum is shown in Fig 12. (Refer to Appendix: Spectrum):

Fig. 12 Magnitude Spectrum

Example:

Let’s consider a square wave given by Fig. 13:[http://www.eas.uccs.edu/~mwickert/ece2610/lecture_notes/ece2610_chap1.pdf]

Fig. 13: A Square Wave

Where,

Therefore,

Refer "Using HPC Cluster" to get the amplitude and phase angle of the square wave using MATLAB script fourierSq.m and synthesize or approximate the square wave up the 15th harmonics (i.e. k = 15) using sqWaveApprox.m.

The approximation is not perfect and moreover in the signal with discontinuities like square wave, increasing the approximations there does not do much improvement. We define the error between the approximation and the true signal as:


There is ringing of ear or the overshoots as the waveform makes discontinuous steps from 0 to 1 and 1 back to 0 known as Gibbs phenomenon. The overshoot persists at about 9% overshoot/undershoot as more terms are added and the frequency of rings increases.

For more Fourier Series examples, visit https://www.math24.net/fourier-series-definition-typical-examples/#example2.

Fourier Transform

Fourier transform decomposes the signal into its constituent frequencies. It is frequency domain representation of original signal. The Discrete Fourier Transform (DFT) replaces the infinite integral with the finite sum (https://ccrma.stanford.edu/~jos/st/Introduction_DFT.html).

Where,

tn = nth sampling instant i.e. nT, wk = kth frequency sample; x(tn) = input signal; N=number of time or frequency samples.

Fast Fourier Transform (FFT) algorithms generally occur when N is a power of 2. The complexity becomes O (NlogN) greatly reduced from O(N2).

See the example in MATLAB DFT function to plot the square wave in frequency domain. The MATLAB script sqDFT.m is used in the section "Using HPC Cluster".

Fourier Filters

Fourier Filter (https://terpconnect.umd.edu/~toh/spectrum/FourierFilter.html) works by taking the Fourier transform of the signal, then attenuating or amplifying specific frequencies, and finally inverse transforming the result. 

See the MATLAB implementation in the section "Using HPC Cluster" 

Using HPC Cluster

Copy the directory "DSP" from /usr/local/doc/DSP and cd to it or get the files from the GitHub - https://github.com/sxg125/digitalSignalProcessing

cp -r DSP /usr/local/doc

cd DSP

Request a compute node

srun --x11 --pty bash

Load the matlab module

module load matlab

Run

matlab -r sincos

output:

Now, check the wave (Fig. 14):

Fig. 14: Sine and Cosine Signal (wave).

Here, the phase angle is 0 as the wave starts at t = 0 for sine wave and phase angle is 90 degree (pi/2) for cosine wave. So, cosine wave is also sinusoidal with a phase difference of π/2 i.e. cosine is leading sine by pi/2 or sine is lagging cosine by π/2.

sin(pi/2 - wt) = coswt

Now, check out the frequency and T.

T = 0.2 sec (for one complete cycle). Hence, f = 1/0.2 = 5 Hz as seen from Fig. 14 where there are 5 cycles in 1 sec.

FIR Filter:

Let’s use MATLAB filter function to get the output signal (Fig 15) using MATLAB script (MovAvg.m):

matlab -r MovAvg

output:

Fig. 15: Output Response from Moving Average FIR Filter.

Let's plot magnitude (Fig 16a) and phase angle (Fig. 16b).

Open Matlab

matlab &

At the prompts, use the following MATLAB comamnds for plotting the magnitude  :

>>  w = -pi:(pi/500):pi;

>> subplot(211); plot(w,20*log10(abs(H)))

>> subplot(212); plot(w,angle(H))

output:

Fig. 16: (a) Magnitude Spectrum (b) Phase Spectrum

The magnitude plot indicates that the moving-average filter passes low frequencies with a gain near 1 and attenuates high frequencies, and is thus a crude low-pass filter. The phase plot is linear except for discontinuities at the two frequencies where the magnitude goes to zero.

Filter Design:

What is the order of filter to get the desired result?

Open Matlab

matlab &

At the prompts, use the following MATLAB comamnd for getting the order:

>> ellipord(2*(pi/3/(2*pi)),2*(pi/2/(2*pi)),1,50)

output:

ans =

    5

What are the filter coefficients - an (feedback coefficients) and bn (feed forward coefficients)

>> [b,a] = ellip(5,1,50,2*(pi/3/(2*pi)))

output:

b =

   0.0194    0.0211 0.0377    0.0377 0.0211 0.0194

a =

   1.0000   -2.7580  4.0110 -3.3711    1.6541 -0.3796

So, the transfer function for IIR becomes:

Is the system stable? (see Fig. 17)

>> zplane(b,a)

output:

Fig. 17: poles and zeros in Z-plane

The system is stable with all the poles located within the unit circle.

Has the amplitude response requirement been met (Fig. 18 (a) (b))?

> w = -pi:(pi/500):pi;

>> H = freqz(b,a,w);

>> subplot(211); plot(w,20*log10(abs(H)))

>> subplot(212); plot(w,angle(H))

output:

Fig. 18: (a) Magnitude spectrum and (b) phase spectrum

Sampling:

Run the matlab script sampling.m to get the plots (Fig. 19 (a)(b)(c)).

matlab -r sampling

output:

Fig. 19: Waves sampled with different sample rates (a) lower to (c) higher. 

Amplitude and Phase Angle of Square Wave:

The amplitude (Fig. 20 (a)) and phase (Fig. 20(b)) spectrum plots are obtained using MATLAB script "fourierSq.m".

matlab -r fourierSq

output:

Fig. 20: (a) Amplitude Spectrum (b) Phase spectrum

Approximating Square Wave:

Synthesizing or approximating the square wave up to 15th harmonics (i.e. k = 15), we get the x15(t) as showed in Fig. 21:

matlab -r sqWavApprox

output:

Fig. 21: Approximation of the square wave up to 15th harmonics (i.e. k = 15)

Fourier Filter Using FFT and inverse FFT:

Add a noise in an original signal (Fig. 22(a)) to get the distorted signal (Fig. 22(b)) and filter it to get the original signal (Fig. 22(c)).

matlab -r fourierFilter

output:

Fig. 22: (a) original signal (b) signal with noise (c) filtered signal similar to original one

Notch Filter: Image Filtering

Notch filter can remove repetitive spectral noise from an image. It can notch out frequencies other than the DC component (zero frequency). It attenuates a selected frequency (and some of its neighbors) and leave other frequencies of the Fourier Transform (FT) relatively unchanged. In sound signal processing, it is used to remove mechanical or electrical hum such as 60Hz hum from AC power.

Run the MATLAB script "notch" to filter the noisy image (Fig. 23 (a)) to get image (Fig. 23 (c)).

cd notchfilter

matlab -r notch

output:

Fig 23: (a) Noisy Image, (b) Fourier Spectrum of image (see the noise peaks as dots) (c) Image after butterworth notch filter (d) Fourier Spectrum after butterworth notch filter.

Tunining Fork

Make sure that the the wave file for the tuning fork "tuning_fork_A4.wav" (Fig. 24 (a)) is present in the working directory. Now, run the Matlab script "tuningfork.m" to get power spectral density (Fig. 24(b)), and Spectrogram function plot (Fig. 24 (c)).

matlab -r tuningfork

output:

Fig. 24: (a) sound wave (signal) produced by tuning fork (b) power spectral density showing startup transients, fundamental frequency (440Hz) and other higher frequencies harmonics (c) spectrogram function plot where higher harmonics are fading with time.

Convolution:

Verification of convolution calculation using MATLAB "conv" command:

x=[2 0 -3 4]

h=[1 2 1 0]

>> y=conv(x,h)

y =

    2 4    -1 -2  5 4 0

Appendix: Linear Time Invariant (LTI) System

As the name suggest, LTI system is both linear and time-invariant i.e. the output or response of the system for the linear combination of inputs is the same as the linear combination of individual responses to those inputs, and the output doesn’t depend on when an input is applied.

For a LTI system T over time t, composed of input signals x1(t) and x2(t) with outputs y1(t) and y2(t):

Where a1 and a2 are constants.

LTI system that takes input x(t) and produces y(t) also, when excited by time shifted signal x(t - u), produces the time shifted output y(t - u). Hence, it is also called shift-invariant.

Consider a LTI system with a step response: - https://staff.fnwi.uva.nl/r.vandenboomgaard/SP20162017/LinearSystems/lin_properties.html

Here, x(t) = u(t) is the step input signal (function)

Let’s create a pulse function as a linear combination of two time shifted step signals which takes the form:

And can be written as:

Now, for LTI system,

This can be plotted as shown below (Fig 25 (a)(b)):

Fig. 25 (a) Time or shift invariance of LTI

Fig. 25 (b) Linearity of LTI

Impulse & Step Response of LTI:

The impulse response of LTI system h(t) is the output y(t) when the input is the unit impulse signal, δ(t) i.e.

x(t) = δ(t), h(t) = y(t)

The step response of LTI system s(t) is the output y(t) when the input is the unit step signal, u(t) i.e.

x(t) = u(t), s(t) = y(t).

Appendix: Convolution

Convolution is a representation of signals as a linear combination of delayed input signals. For LTI system, we can use impulse response h[n] to predict the response to any input x([n] (https://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-02-introduction-to-eecs-ii-digital-communication-systems-fall-2012/lecture-slides/MIT6_02F12_lec10.pdf):

The impulse response completely characterizes the LTI system S.

Y[n] = x[n] * h[n]

where * denotes convolution.

Example: Convolution using Z-transform

Verify the result using the Matlab "conv" command as described in "Using HPC Cluster" section.

Appendix : Poles and Zeros

Consider the transfer function

Looking at RC filter transfer function, 

there are no zeros in RC filter but one pole as shown in Fig. 26.

Fig. 26: poles and zeros in s-plane

The cut-off frequency is the value of the pole i.e.

Plot z-transform for the following transfer function of moving average filter with impulse signal.

The pole-zero diagram is created using Matlab function as shown in Fig below where zero frequency corresponds to (1,0), positive frequencies advancing counterclockwise around the unit circle to the Nyquist frequency at (-1,0). Two poles are located at the origin (z2 = 0) and the zeros are located at the solution of z2 + z + 1 = 0, i.e.

Use MATLAB command to get the z-plane pole-zero plot (Fig. 27).

>> zplane ([1 1 1],[1]) 

output:

Fig. 27: Pole/zero diagram of a second-order FIR filter in z-plane

Appendix: Signal Transformations

https://www.princeton.edu/~cuff/ele301/files/lecture1_2.pdf

https://staff.fnwi.uva.nl/r.vandenboomgaard/SP20162017/SystemsSignals/signaltransformations.html

Consider a given signal:

How does it look like when it is scaled and right shifted as x(t) -> x(2(t - u)) where u = 1?

How does it look like when it is right shifted and then scaled?

Appendix: Signal/Wave in a Complex Form

Let’s represent the wave in complex form (i.e polar form). The complex part of the real number is represented by either i or j and is given by:

Let’s first represent a point in complex plane as shown in Fig. 28:

Fig. 28: A point represented in a complex plane

A point or position vector (z) in a two-dimensional Cartesian coordinate system can be written as:

Where, x and y are real numbers i.e. x is the real part of z and y the imaginary part of z.

This can be written in polar form as:

Euler’s formula state that for any real number x,

Hence,

Complex Conjugate:

The complex conjugate of z  is defined as:

Appendix : Laplace Transformation

Alternatively, instead of trying to find the solution in the time domain, each time variable, as well as the differential equations, can be transformed to a different variable domain in which the solutions can be obtain in a more straightforward way; then an inverse transform would take place the solution into the time domain. Using the Laplace transform, the constant coefficient linear differential equations that model physical systems can be transformed into algebraic equations.

Let’s try to find the Laplace Transform of the decaying exponential.

Fig. : Time Vs Lapalce Domain - https://www.pdx.edu/nanogroup/sites/www.pdx.edu.nanogroup/files/NOTES_Transfer%20function%20Laplace%20Transormation%20Active%20filter_0.pdf

Table of Laplace Transform - https://www.slideshare.net/bawaparam/laplace-table-32774643

Example:

The voltage across the capacitor in the ckt w.r..t can be written as:

In s space, it becomes:

Hence, the transfer function can be written as:

It is same as replacing jw with s.

Appendix - Z Transform

It is a powerful mathematical tool to convert differential equations into algebraic equations. A special feature of the z-transform is that for the signals and system of interest to us, all of the analysis will be in terms of ratios of polynomials. Working with these polynomials is relatively straight forward. The Z transformation is a direct outgrowth of the Laplace transformation and the use of a modulated train of impulses to represent a sampled function mathematically. The Z transformation allows us to apply the frequency domain analysis and design techniques of continuous control theory to discrete control systems.

The z transform of the discrete-time signal x(n) is defined to be

Where, z is a complex variable and z-n is the time delay operator

Unit Pulse:

For unit pulse,


X(z) = x(0)* z0 = 1 * 1 = 1

Example: Plot translated pulse function: 3𝛿(t - 2) (Fig. 29)

Fig. 29: Amplified (by 3) and Shifted (by 2 steps) pulse function

Unit Step:

For unit step,

x(n) = u(n),

where

The sum can be written as:

For exponential sequence,

x(n) = anu(n)

The sum can be written as

Appendix - Spectrum

A signal can be viewed as a composition of a number of sinusoidal signals with varied amplitude, frequency and phase. A signal’s frequency spectrum is its presentation in the frequency domain.

Manipulating multiple sinusoids is actually easier when we form a complex exponential representation ([http://www.eas.uccs.edu/~mwickert/ece2610/lecture_notes/ece2610_chap1.pdf]).

Sum of Sinusoids:

Signals  that are composed of multiple sinusoids having different amplitudes, frequencies, and phases can be written as:

Using the inverse Euler formulas that expand each real cosine into two  complex exponentials, where,

we get:

Where Xk* is the complex conjugate of Xk.

Example: Plot the Magnitude phase spectra of a signal

Let’s plot the magnitude phase spectra for the following signal ([http://www.eas.uccs.edu/~mwickert/ece2610/lecture_notes/ece2610_chap1.pdf]):

It can be re-written in terms of complex exponentials:

At zero frequency f(0), X0 = A0 = 5 and phase = 0; at f (+-50Hz) A1 = |X1/2|  = 3/2 = 1.5 and phase = +-0.2936; at f(+-300), A2=|X2/2| = 6/2 = 3 and phase = +-1.57. It can be plotted as shown below (30 (a)(b)):

Fig. 30: (a) Magnitude and (b) Phase Spectrum

Appendix: Odd and Even Functions

For even function (i.e. f(-t) = f (t)), integral of sine will have value zero and for odd function (f(-x) = -f(x), the integral of cosine will have value zero. Also, the graph of an odd function is always symmetrical about the origin.

Odd function (Fig. 31):

f(t) = sinπt

Fig. 31: Odd function

Even function (Fig. 32):

f(t) = 2cosπt

Fig. 32: Even function

Appendix: Periodic and Aperiodic Signal

The signal is periodic if it repeats after certain period.

x(t + T0) = x(t)

The smallest period that satisfies the condition is called fundamental period (T0) and the inverse of T0 is called the fundamental frequency (f0).

If the multiple sinusoids is periodic, the component frequencies are integral multiples of the fundamental frequency and are called harmonics.

Consider a signal, the sinusoidal multiplication ([http://www.eas.uccs.edu/~mwickert/ece2610/lecture_notes/ece2610_chap1.pdf]).

It can be re-written in the trigonometry form cos (A + B) + cos (A - B):

It has component sinusoids at f0 = 1/T0 = 2Hz (fundamental frequency) and the 9th harmonic f9 = 18Hz (9 x f0).

The center frequency (fc) is (f1 + f2)/2 = (18 + 2)/2 = 10 and deviation frequency (fdelta) is (f2 - f1)/2 = 8.

Since the deviation and center frequency are closer, beat notes don’t occur. However, if you change the value of fc = 100 and fdelta=5 i.e.

You will see lower frequency enveloping the higher frequency as shown below in Fig. 33:

Fig. 33: Lower frequency enveloping the higher frequency 

Similar concept is used for Amplitude modulation where the message or information bearing signal has very low frequency compared to the carrier frequency.

Let’s consider three term approximation of square wave ([http://www.eas.uccs.edu/~mwickert/ece2610/lecture_notes/ece2610_chap1.pdf]):

The signal is periodic with f0 = 100Hz, f3 = 300Hz and f5=500Hz (Fig. 34).

Fig. 34: Periodic Signal

However, introduction of small frequency deviation among the various components can result in non periodicity as shown in Fig. 35:


Fig. 35: Aperiodic Signal

Note that the line spectrums of both the square signals are very similar (Fig. 36(a)(b)).

Fig. 36: Spectrum comparison between (a) periodic and (b) aperiodic signals

Example - 440Hz Tuning Fork:

Let’s consider a signal from the 440hz tuning fork which is the frequency of musical note of A (A4) above C and serves as a general tuning standard for musical pitch. Refer to "Using HPC Cluster" section for the plot of fundamental frequency and the harmonics.

References:

Fundamentals of Speech Recognition: https://www.isip.piconepress.com/courses/msstate/ece_8463/lectures/current/lecture_12/lecture_12.pdf

Introduction to Signal & Systems - http://www.eas.uccs.edu/~mwickert/ece2610/lecture_notes/ece2610_chap1.pdf

Frequency Response and Active Filters - http://www.swarthmore.edu/NatSci/echeeve1/Ref/FilterBkgrnd/Filters.html

Basic Intro to Filters:

http://www.swarthmore.edu/NatSci/echeeve1/Ref/DataSheet/IntroToFilters.pdf

Filters & Transfer functions:

http://www.kves.uniza.sk/kvesnew/dokumenty/DREP/Filters/352_32115_EC434_2012_4__3_1_Chapter_03.pdf

Passive Low Pass Filter - https://www.electronics-tutorials.ws/filter/filter_2.html

Effects of poles and Zeros on Frequency Response - http://www.ee.ic.ac.uk/pcheung/teaching/ee2_signals/Lecture%209%20-%20Poles%20Zeros%20&%20Filters.pdf

Filter Design Guide - http://alignment.hep.brandeis.edu/Lab/Filter/Filter.html

Fourier Series: https://www.math24.net/fourier-series-definition-typical-examples/

WolframMathword: http://mathworld.wolfram.com/

Wikipedia - https://www.wikipedia.org/

Fourier Series Interactive Graph: https://www.intmath.com/blog/mathematics/fourier-series-interactive-graph-7719

Filters and Fourier Transform: http://users.cs.cf.ac.uk/Dave.Marshall/Multimedia/PDF/02_Filters_and_Fourier_Transforms.pdf

The scientist and Engineer’s Guide to DSP - http://www.dspguide.com/ch13/4.htm

DFT: https://ccrma.stanford.edu/~jos/st/

Signal and Systems: https://www.tutorialspoint.com/signals_and_systems/signals_and_systems_overview.htm