Thursday 8 August 2024

Mastering Digital Signal Processing: Your Essential Guide for the FE Electrical Exam

Mastering Digital Signal Processing

The FE requires examinees for the FE Electrical exam to be able to solve DSP equations. Here, we will provide a brief introduction to the topic and several useful equations that will help prepare you for your upcoming exam.



Sampling

The sampling theorem states that in order to accurately reconstruct a continuous-time signal from its samples, the sampling rate must be at least twice the highest frequency component in the signal. This minimum sampling rate is known as the Nyquist rate. If the sampling rate is below the Nyquist rate, aliasing occurs, leading to distorted or misleading reconstructions.

1. Nyquist Theorem

A signal can be represented in its sample and can be recovered back when using the sampling frequency (fs) or sampling angular frequency (ω_s=2πf_s) is greater or equal to twice the max frequency component of the signal (McClellan et al., 2021, 111) where:

fs≥2fmax or ωs≥2ωmax   (1)

For instance, considering the constraints of human auditory perception, the upper limit of discernible frequencies for human hearing is approximately 20 kHz (D et al., 2001). Consequently, to accurately capture and reproduce audio signals while adhering to the Nyquist Theorem, widely adopted media formats such as compact discs (CDs) and numerous digital audio files employ a sampling frequency of 44.1 kHz.

During the sampling process, it is customary to adhere to the Nyquist rate to ensure a faithful representation of the original signal. However, it is worth noting that alternate approaches, such as oversampling or undersampling, can also be employed to capture signals with distinct characteristics. 

2. Aliasing

Aliasing occurs when the sampling rate is less than the Nyquist rate, causing overlapping of the frequency components of the continuous-time signal. Aliasing leads to the creation of false frequency components, making it difficult to accurately reconstruct the original signal.

However, the signal can be reconstructed by filtering out frequencies above 1/2 fs. To ensure accurate sampling, it is crucial that the signal to be sampled possesses a frequency content that is limited to half the sampling frequency. Failure to adhere to this requirement leads to aliasing, an undesirable phenomenon where different frequency components overlap and distort the reconstructed signal.

When the highest frequency in the signal is greater than half of the sampling frequency, then aliasing occurs. Through graphical analysis, it can be observed that the frequency (f) that surpasses half the sampling frequency will result in a signal reconstruction with aliasing at the difference between the sampling frequency (fs) and f, denoted as fs - f.

For 0.5fs < f <1.5fs, the aliasing will appear at |fs-f|.
For 1.5fs < f <2.5fs, the aliasing will appear at |2fs-f|.
For 2.5fs< f <3.5fs, the aliasing will appear at |3fs-f| and so on (Hasegawa, 2021, 23).

Example: 

What is the frequency (Hz) of the artifact in the reconstructed signal if the function is Acos(640πt+Φ) and the signal is sampled at 120 Hz?

Solution:

1. Since the question is asking for frequency (Hz), we need to identify the max frequency and sampling frequency:

fmax=640π/2π=320 (Hz)
fs=120 (Hz)

2. Check the criteria of fmax compare to fs. You will need to keep testing until the right criteria is reached.

2.5fs< f <3.5fs
2.5(120)<320<3.5(120)
300<320<420

3. Find the artifact frequency via |3fs-f|

fartifact=|3(120)-320|=40 (Hz)


Digital Filters

Based on the FE Electrical and Computer topic list, the subtopics covered in the Digital Filters are Difference Equation and Z-Transform. However, Finite Impulse Response (FIR) and Infinite Impulse Response (IIR) shall not be neglected even though they were not listed. 

1. Difference Equation

A difference equation is a mathematical equation that represents the relationship between the input and output signals of a discrete-time system. It describes how the current and past input values, as well as the current and past output values, are combined to compute the current output value (McClellan et al., 2021, 147).

A general form of a difference equation is:

y[n]=a0 x[n]+a1 x[n-1]+...+b0 y[n-1]+b1 y[n-2]+...   (x)

Where, 

y[n] is the current output at discrete time n.

x[n] is the current input at discrete time n.

x[n-1],... is the past input values.

y[n-1],... is the past output values.

a0, … and b0,... are the coefficients of the difference equation.  

Example: 

y[n]=4x[n]+2y[n-1]+2y[n-2]; y[n]=0 for n<0

What is the impulse response of a system described by the difference equation? 

Solution: 

1. For impulse response, x[n]=δ[n] and δ[0]=1 and δ[n≥1]=0

. n=0

y[0]=4δ[0]+2y[0-1]+2y[0-2]=4(1)+y[-1]+y[-2]=4+0+0=4

. n=1

y[1]=4δ[1]+2y[1-1]+2y[1-2]=4(0)+2y[0]+2y[-1]=0+2(4)+2(0)=8

. n=2

y[2]=4δ[2]+2y[2-1]+2y[2-2]=4(0)+2y[1]+2y[0]=4+2(8)+2(4)=28

You can keep computing for n approaches ∞ but the solution right is h[n]={4.8,28,...}

2. Z-Transform

The z-transform provides a way to represent discrete-time signals or sequences as functions of a complex variable, denoted as "z." It is defined as the sum of the sequence multiplied by powers of z, where z can be any complex number (McClellan et al., 2021, 348). The z-transform of a discrete-time sequence x[n] is given by:

         ∞
X(z)= x[n]z-n(x)
       n = 0

In the exam, a table of z transform paris is provided in the Reference Handbook p.372. 

Example: 

Find the z-transform X(z) of the following signal: 

x[n]=δ[n]+1/5 δ[n-2]-3/4 δ[n-4]

Solution: 

1. Use the summation definition (equation x) to solve for the z transform:

X(z)= x[n]z-n
n = 0

2. x[n] is zero for all values of n except when n=0,2,and 4.

x[n]={1,0,1/5,0,-3/4}

. n=0, z transform is

x[0]z-0=1⋅1=1

. n=2, z transform is

x[2]z-2=1/5⋅z-2

. n=4, z transform is

x[4]z-2=-3/4⋅z-4

So, X(z)=1+1/5 z-2-3/4 z-4

3. Finite Impulse Response (FIR)

The FIR system, or, as we often refer to them, FIR filter, is a type of digital filter whose output is determined by a weighted sum of past and present input samples (McClellan et al., 2021, 147).

The output of the FIR filter can be calculated as:

Y(n)= bnx[n-k]
k = 0

4. Infinite Impulse Response (IIR)

In contrast to FIR filter, the output of IIR filter is the sum of the values of past inputs plus past outputs (McClellan et al., 2021, 394).

The output of the IIR filter can be calculated as: 

y[n] = ∑l=0 bl x[n-l] + ∑k=0 ak y[n-k]

Example: 

With the given filter below

y[n]=x[n]+1/6 x[n-1]

What type of filter is it?

Solution: 

1. By looking at the function, the output contains the sum of the current and past inputs. Therefore, it is an FIR filter. 

2. Do a z-transform to determine if it is a low-pass, high-pass, band-pass, or band-reject filter. 

y[n]=x[n]-1/6 x[n-1]

Use the z-transform pair from Reference Handbook p.372, we have 

Y(z)=X(z)-1/6 X(z)z^(-1)

H(z)=(Y(z))/(X(z))=1-1/6 z^(-1)=(z-1/6)/z


Conclusion

This blog aims to serve as a valuable point of reference, offering concise explanations and practical examples for each topic addressed in the exam. It is important to note, however, that while the blog provides a helpful overview, it may not encompass all aspects related to digital signal processing. For a more thorough and comprehensive study plan, I recommend visiting School of PE’s FE Electrical exam review course FE Electrical exam review course, which offers an extensive and detailed curriculum to ensure a comprehensive understanding of the subject matter.


References

D, P., GJ, A., & D, F. (2001). Neuroscience 2nd edition. Sunderland (MA): Sinauer Associates. https://www.ncbi.nlm.nih.gov/books/NBK10924/

Hasegawa, M. (2021). Lecture 6: Sampling and Aliasing. Retrieved June 6, 2023, from https://courses.engr.illinois.edu/ece401/fa2021/lectures/lec06.pdf

McClellan, J. H., Schafer, R. W., & Yoder, M. A. (2021). DSP First Second Edition. Pearson.


About the Author: Khoa Tran

Khoa Tran is an electrical engineer working at the Los Angeles Department of Water and Power and is currently pursuing his master's in electrical Power from the University of Southern California. He is fluent in both Vietnamese and English and is interested in outdoor activities and exploring new things.

No comments :

Post a Comment