Experiment Name: Introduction to Aliasing Effect.
Theory:
Aliasing is an effect in signal processing where a high-frequency signal is represented or sampled
at a lower rate, leading to an ambiguous and distorted representation of the original signal. This
occurs when the sampling rate is not sufficient to capture all the details of the signal and can
result in the high frequency components appearing as lower frequency components. This can
cause significant degradation in signal quality and result in incorrect data analysis. To avoid
aliasing, a low-pass filter, known as an anti-aliasing filter, is typically used to remove high-
frequency components before the signal is sampled.
The conditions for the aliasing effect to occur are:
1. Sampling frequency: The aliasing effect occurs when the sampling frequency is lower than the
Nyquist frequency, which is half the maximum frequency of the signal being sampled.
2. Bandwidth of the signal: If the bandwidth of the signal being sampled is greater than the Nyquist
frequency, then the aliasing effect will occur.
3. Sampling theorem: According to the sampling theorem, a continuous signal can be perfectly
reconstructed from its samples if the sampling rate is greater than twice the highest frequency
component in the signal. If the sampling rate is lower than the Nyquist frequency, then the aliasing
effect will occur.
4. Anti-aliasing filter: The use of an anti-aliasing filter is important in preventing the aliasing
effect. The filter limits the bandwidth of the signal being sampled to ensure that it does not exceed
the Nyquist frequency.
In summary, the aliasing effect can be prevented by ensuring that the sampling rate is greater than
the Nyquist frequency, that the bandwidth of the signal being sampled is limited to less than the
Nyquist frequency, and that an anti-aliasing filter is used to remove high-frequency components
from the signal.
Source Code:
import matplotlib.pyplot as plt
import numpy as np
xn = [0,3,2,1,0,1,2,3,0]
yn = [0]*9
yn2 = [0]*9
for i in range(1,8):
yn[i] = (xn[i-1]+xn[i]+xn[i+1])/3
yn2[i] = yn2[i-1] + xn[i]
plt.figure(figsize=(12,20))
n = np.arange(-4,5,1)
plt.subplot(311)
plt.stem(n, xn)
plt.title("x(n)")
plt.subplot(312)
plt.stem(n, yn)
plt.title("y(n)=(x(n-1)+x(n)+x(n+1))/3")
plt.subplot(313)
plt.stem(n, yn2)
plt.title("y(n)=x(n)+x(n-1)+x(n-1)+......")
plt.show()
Sample Input & Output:
Analysis:
In this experiment we can see the discrete time analog signal .We used Google Colab for
representing signals in python. We used various python library such as matplotlib, numpy, figure(),
plot, subplot etc. Initially we felt it difficult to finish our work. But gradually we become used to
it.