0% found this document useful (0 votes)
102 views29 pages

Course Number: EEE343L Project Report: BRAC University Semester-Fall 2022

This document provides a summary of a digital signal processing laboratory project. It discusses discretizing a continuous signal using a sampler, passing the discrete signal through a radar that adds attenuation and delay, adding noise to simulate real-world conditions, and processing the distorted signal through a linear time-invariant system. Key steps include generating the original signal as a sum of three inputs, sampling it, observing the signal in the frequency domain, modeling the radar effect, adding noise, and convolving the input with the LTI system's impulse response to generate the output. Plots of signals at various stages are provided.

Uploaded by

api-676412198
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views29 pages

Course Number: EEE343L Project Report: BRAC University Semester-Fall 2022

This document provides a summary of a digital signal processing laboratory project. It discusses discretizing a continuous signal using a sampler, passing the discrete signal through a radar that adds attenuation and delay, adding noise to simulate real-world conditions, and processing the distorted signal through a linear time-invariant system. Key steps include generating the original signal as a sum of three inputs, sampling it, observing the signal in the frequency domain, modeling the radar effect, adding noise, and convolving the input with the LTI system's impulse response to generate the output. Plots of signals at various stages are provided.

Uploaded by

api-676412198
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

Department of Electrical & Electronic Engineering

BRAC University
Semester-Fall 2022
Course Number: EEE343L
Course Title: Digital Signal Processing Laboratory

Project Report
Section: 01
Name of the project-
Date of Submission- 05/12/22
Prepared by:
Group Number: 05

Sl. ID Name
1. 20121073 Tahmid Al Deen
2. 20121060 Khandakar Sajid Rahman
3. 20221040 Anika Binte Aman
4. 20321057 Nushin Nawar
Theory-
Any continuous signal that represents another quantity is referred to as an analog signal or
analogue signal .An analog signal, which can represent any information, is a quantifiable
response to changes in a physical variable such as sound, light, temperature, position, or
pressure.But for processing purpose prefer digital conversion.Digital signals can convey
information with less noise, distortion, and interference.Digital signal processing is more flexible
because DSP operations can be altered using digitally programmable systems.In addition ,Digital
signal processing is more secure because digital information can be easily encrypted and
compressed.Apart from this,Digital systems are more accurate, and the probability of error
occurrence can be reduced by employing error detection and correction codes.

Sampling-It is the conversion of continuous time signal to discrete time signal by taking
“sample” of continuous time signal at discrete instants

LTI System ( Linear Time Invariance System)-


a linear time-invariant (LTI) system is a system that produces an output signal from any input signal subject to
the constraints of linearity and time -invariance.Any LTI system may be completely described by a single
function known as the system's impulse response, which is the core conclusion of the study of LTI systems.
Methodology-
This project involves discretizing a signal x(t), which is the sum of three input signals, by
running it through a sampler.. This discrete signal will then pass across a radar, adding noise,
simulating a real-world incident. This distorted signal is received by the LTI. What we
observe are the mechanism and the result.

The message signal is x(t). The output of a three-input adder is referred to as the message
signal. The adder's inputs are listed below.

Simulations and Output:


Generating input:
The three inputs' respective frequencies must first be ascertained.
If we look at the inputs from the methodology section, we can see that the three signals have
the following characteristics.
1st Adder:
From the graph,
Amplitude of an input = 5
Time period = 0.005 seconds
1 1
So, frequency, f = 𝑡
= 0.005
= 200 Hz

2nd Adder:
From the graph,
Amplitude of an input = 5
Time period = 0.01 seconds
1 1
So, frequency, f = 𝑡
= 0.01
= 100 Hz

3rd Adder:
From the graph,
Amplitude of an input = 3
Time period = 0.004 seconds
1 1
So, frequency, f = 𝑡
= 0.004
= 250 Hz

%x(t) generation:
Code:
clc;
clear all;
close all;
t = 0 : 1/30000 : 0.02;
f1 = 200;
x1=5*cos(2*pi*f1*t); % Adder input 1
f2 = 100;
x2=5*cos(2*pi*f2*t); % Adder input 2
f3=250;
x3=3*cos(2*pi*f3*t); % Adder input 3
xt=x1+x2+x3; % Output of Adder = x(t)
figure;
plot(t,xt),title('output of Adder= x(t)=x1(t)+x2(t)+x3(t)'),xlabel('Time(sec)'),ylabel('Amplitude')
Output:

Fig: Waveform of x(t)

We can observe the frequency response of the output sampler, which is the sum of the three
input signals of the adder, in this case. There is a maximum amplitude of 13 for the adder's
output signal. The three signals that make up this adder's inputs have a total amplitude of 13.
The output signal proves that the sampler's output is equal to the sum of the adder's inputs as a
result.

The sampler's design:


We constantly receive the same signal. It now has to go via a sampler. The Nyquist theorem
states that the sampling frequency must be at least twice that value. The signal can have a
maximum frequency of 250Hz. The sampling frequency must thus be at least twice as high as
250 Hz. In this case, we'll sample at 30,000 hertz (Hz).
Code:
Fs = 30000; % Sampling frequency
F1 = f1/Fs;
F2 = f2/Fs;
F3 = f3/Fs;
N = 1/F3;
n = 0 : 5*N; %Discrete values
% Adding discrete signals
discrete_xt=5*cos(2*pi*F1*n)+5*cos(2*pi*F2*n)+3*cos(2*pi*F3*n);
figure;
stem(n,discrete_xt);
title("Discrete Output = x(n)");
xlabel("Discrete values N"),ylabel("Amplitude");

Output:

Fig: Discrete output x(n)’s waveform

The graph shows how the initial continuous signal is changed into a discrete signal.
FFT after sampling
Code:
fft_xt = fft(xt,length(xt)); % fast fourier transform of x(n)
id = (30000/length(xt))*(0:length(fft_xt)/2-1);
fft_xt = fft_xt (1:length(fft_xt)/2) ;
figure;
stem(id,abs(fft_xt)),title("x(n) in terms of Frequency"),xlabel("Frequency
(Hz)"),ylabel("Amplitude"),xlim([0,1000]);

Output:

Fig: Waveform of x(n) in frequency domain

Here, we can see three spikes at frequencies of 99.83Hz, 199.7Hz, and 249.6Hz, indicating that
x(t) contains three frequency components or that x(t) was produced by adding three signals of
various frequencies . These frequency components agree with the frequency values we
determined using the three input signals provided.
Rader:
Radar will now be used to send the signal x(t), which will have an attenuation factor and a time
delay applied to it. The highest digit on my ID is "7," while the lowest digit (apart from 0) is "1."
As a result, the radar's input has an attenuation value of 0.7 and is one element delayed. In
order to employ attenuation, the signal will be multiplied by the attenuation factor and moved to
the right for delay.

Code:

attenuation=0.7; % A=7 (A=Highest Digit of my ID)


delay=1;% B=1 (B=Lowest Digit of my ID)
radar_output=attenuation.*discrete_xt;
radar_output_n=n+delay;
figure;
stem(radar_output_n, radar_output),title("Attenuated and delayed
signal"),xlabel("N"),ylabel("Amplitude"),xlim([0,600]);

Output:

Fig. Rader output signal waveform with attenuation and delay.

We can observe from the graph that the amplitude has dropped from 13 to 9.1 (because
13*0.7=9.1) Here, the radar has a 0.7 attenuation factor and is one element delayed.
FFT After attenuation:
Code:
fft_radar_output = fft(radar_output,length(radar_output));
id = (30000/length(radar_output))*(0:length(fft_radar_output)/2-1);
fft_radar_output = fft_radar_output (1:length(fft_radar_output)/2);
figure;
stem(id,abs(fft_radar_output)),title("x(n) in terms of Frequency in Rader
Output"),xlabel("Frequency (Hz)"),xlim([0,1000]),ylabel("Amplitude");

Output:

Figure: A frequency domain waveform with attenuation and delay added.

Noise:
Code:
noise=(n>=7).*rand([1,length(n)]);
figure;
stem(n,noise),title("Generated random noise"),xlabel("N"),ylabel("Amplitude");
Output:

Fig. A noise signal with a waveform that starts at N=7

LTI System:
Code:
LTI_input=radar_output+noise; % Noise Addition
LTI_n=radar_output_n;
figure;
stem(LTI_n,LTI_input),title("Input of the LTI
system"),xlabel("N"),ylabel("Amplitude"),xlim([0,600]);

Output:
Fig. LTI System input

FFT:
Code:
%Input of LTI System in frequency domain
LTI_input_fft=fft(LTI_input,length(LTI_input)); % fast fourier transform of LTI input
id=(30000/length(LTI_input))*(0:length(LTI_input_fft)/2-1);
LTI_input_fft=LTI_input_fft(1:length(LTI_input_fft)/2) ;
figure;
stem(id,abs(LTI_input_fft))
title("LTI system's input in terms of frequency"),xlabel("Frequency
(Hz)"),ylabel("Amplitude"),xlim([0,1000]);

Output:
Fig: Frequency input for the LTI system

According to the aforementioned graph, random noise causes the spikes at frequencies of
99.83Hz, 199.7Hz, and 249.6Hz to be high with minimal amplitude variation. However, our
frequency components are comparable.

Region of convergence:
A discrete stable system requires that each of the poles be contained within the unit circle.
Additionally, we can see that both poles are inside the unit circle at the point of our given
pole-zero, indicating that the system is stable.
Fig: Pole Zero Location of LTI System

Using the pole zero plot and z transform we get,


2 2
(𝑧+1) (𝑧 +2𝑧+1)
(𝑧+0.25)(𝑧−0.5)
= 2
(𝑧 −0.25𝑧−0.125)

2
Dividing by 𝑧 ,
1+2𝑧−1+𝑧−2
1−0.25𝑧−1−0.125𝑧−2

Using the equation's coefficients in the code. On the other hand, we must guarantee that ROC
is outside the outermost pole in order to make a system causal. As 0.5 is the outermost pole,
the ROC for a causal system in this case is z>0.5.

LTI Output System Generation:


The impulse response should be generated using the coefficients we learnt in the previous part,
convolved, and then the LTI system output should be produced. We will use an impulse function
that is one element delayed because the radar delayed our signal by one element.

LTI System Output:


Code:
x = [1, 2, 1];
y = [1, -0.25, -0.125];
n = 30; % Generating impulse
[h,t] = impz(x, y, n);
LTI_output_n = (min(LTI_n)+min(t)) : (max(LTI_n)+max(t)); % Index determine
LTI_output = conv(h,LTI_input);
figure;
stem(LTI_output_n, LTI_output),title("Output of LTI
system"),xlabel("N"),ylabel("Amplitude"),xlim([0,600]);
Output:

Fig. LTI system output signal

Here, we can see a delay at the signal's beginning as expected, and the output signal likewise
conforms to our predictions.

Output from the LTI system in the frequency range:


Code:
LTI_output_fft = fft(LTI_output,length(LTI_output));
id = (30000/length(LTI_output))*(0:length(LTI_output_fft)/2-1);
LTI_output_fft = LTI_output_fft(1:length(LTI_output_fft)/2);
figure;
stem(id,abs(LTI_output_fft)),title("Output of LTI system (Frequency Domain)"),xlabel("Frequency
(Hz)"),ylabel("Amplitude"),xlim([0,2000])

Output:
Figure: The LTI System's output signal in the frequency domain.

The graph shows that the output graph appears to peak around 95.24 Hz. As a result, the signal
is strongest at this frequency.

Output's predominant frequency component:


Here from the output curve in the frequency domain, we see that the highest peak resides at
95.24Hz frequency. Thus, we can say that the dominant frequency component of the output is
95.24Hz or 95Hz.

Fig: Dominant frequency at highest amplitude (95.24Hz)


Frequency-domain analysis of input and output:

The input signals contain noticeable spikes at frequencies of 99.83Hz, 199.7Hz, and 249.6Hz,
as can be seen above. Due to random noise, additional, less significant spikes are also
noticeable. As a result, the signal still includes three frequency components. However, the
output's frequency response exhibits the strongest signal at 95.2381. Since there is no noise,
there are no peaks in the input at other frequencies. However, output noise has an impact on
other peak frequencies.
Main Code:
clc;
clear all;
close all;
t = 0 : 1/30000 : 0.02;
f1 = 200;
x1=5*cos(2*pi*f1*t); % Adder input 1
f2 = 100;
x2=5*cos(2*pi*f2*t); % Adder input 2
f3=250;
x3=3*cos(2*pi*f3*t); % Adder input 3
xt=x1+x2+x3; % Output of adder = x(t)
figure;
plot(t, xt)
title("output of Adder = x(t)=x1(t)+x2(t)+x3(t)");
xlabel("Time(sec)");
ylabel("Amplitude");
%input signal in frequency domain
fft_xt = fft(xt,length(xt)); % fast fourier transform of x(n)
id = (30000/length(xt))*(0:length(fft_xt)/2-1);
fft_xt = fft_xt (1:length(fft_xt)/2) ;
figure;
stem(id,abs(fft_xt))
title(" x(n) in terms of Frequency");
xlabel("Frequency (Hz)");
ylabel("Amplitude"),xlim([0,1000]);
%Sampler in time domain
Fs = 30000; % Sampling frequency
F1 = f1/Fs;
F2 = f2/Fs;
F3 = f3/Fs;
N = 1/F3;
n = 0 : 5*N; %Discrete values
% Adding discrete signals
discrete_xt=5*cos(2*pi*F1*n)+5*cos(2*pi*F2*n)+3*cos(2*pi*F3*n);
figure;
stem(n,discrete_xt);
title("Discrete Output = x(n)");
xlabel("Discrete values N"),ylabel("Amplitude");
%Sampler in frequency domain
fft_xt = fft(discrete_xt,length(discrete_xt)); % fast fourier transform of
x(n)
id = (30000/length(discrete_xt))*(0:length(fft_xt)/2-1);
fft_xt = fft_xt (1:length(fft_xt)/2);
figure;
stem(id,abs(fft_xt))
title("x(n) in terms of Frequency");
xlabel("Frequency (Hz)"),ylabel("Amplitude"),xlim([0,1000]);
%Radar in time domain
attenuation=0.7; % A=7 (A=Highest Digit of my ID)
delay=1;% B=1 (B=Lowest Digit of my ID)
radar_output=attenuation.*discrete_xt;
radar_output_n=n+delay;
figure;
stem(radar_output_n, radar_output)
title("Attenuated and delayed signal")
xlabel("N"),ylabel("Amplitude"),xlim([0,600]);
%Radar in freq domain
fft_radar_output = fft(radar_output,length(radar_output));
id = (30000/length(radar_output))*(0:length(fft_radar_output)/2-1);
fft_radar_output = fft_radar_output (1:length(fft_radar_output)/2);
figure;
stem(id,abs(fft_radar_output))
title("x(n) in terms of Frequency in Rader Output")
xlabel("Frequency (Hz)"),xlim([0,1000]);
ylabel("Amplitude");
%Generating Noise
noise=(n>=7).*rand([1,length(n)]);
figure;
stem(n,noise)
title("Generated random noise");
xlabel("N"),ylabel("Amplitude");
%Input of LTI System in time domain
LTI_input=radar_output+noise; % Noise Addition
LTI_n=radar_output_n;
figure;
stem(LTI_n,LTI_input)
title("Input of the LTI system");
xlabel("N"),ylabel("Amplitude"),xlim([0,600]);
%Input of LTI System in freq domain
LTI_input_fft=fft(LTI_input,length(LTI_input)); % fast fourier transform of
LTI input
id=(30000/length(LTI_input))*(0:length(LTI_input_fft)/2-1);
LTI_input_fft=LTI_input_fft(1:length(LTI_input_fft)/2) ;
figure;
stem(id,abs(LTI_input_fft))
title("input of LTI system in terms of frequency");
xlabel("Frequency (Hz)"),ylabel("Amplitude"),xlim([0,1000]);
%output of LTI system in time domain
x = [1, 2, 1];
y = [1, -0.25, -0.125];
n = 30; % Generating impulse
[h,t] = impz(x, y, n);
LTI_output_n = (min(LTI_n)+min(t)) : (max(LTI_n)+max(t)); % Index determine
LTI_output = conv(h,LTI_input);
figure;
stem(LTI_output_n, LTI_output)
title("Output of LTI system");
xlabel("N"),ylabel("Amplitude");,xlim([0,600]);
%LTI System Output in freq domain
LTI_output_fft = fft(LTI_output,length(LTI_output));
id = (30000/length(LTI_output))*(0:length(LTI_output_fft)/2-1);
LTI_output_fft = LTI_output_fft(1:length(LTI_output_fft)/2);
figure;
stem(id,abs(LTI_output_fft))
title("Output of LTI system in terms of frequency");
xlabel("Frequency (Hz)"),ylabel("Amplitude"),xlim([0,2000]);

modifying the system's sampling frequency:


Here, Sampling Frequency = 300 Hz ( Below Nyquist rate Theorem ) [Decrease]

Code:
Fs = 300; % Sampling frequency
F1 = f1/Fs;
F2 = f2/Fs;
F3 = f3/Fs;
N = 1/F3;
n = 0 : 5*N; %Discrete values
% Adding discrete signals
discrete_xt=5*cos(2*pi*F1*n)+5*cos(2*pi*F2*n)+3*cos(2*pi*F3*n);
figure;
stem(n,discrete_xt);
title("Discrete Output = x(n)");
xlabel("Discrete values N"),ylabel("Amplitude");

Output:
Fig: Waveform of discrete output x(n) at sampling frequency=300 Hz

Code:
fft_xt = fft(xt,length(xt)); % fast fourier transform of x(n)
id = (300/length(xt))*(0:length(fft_xt)/2-1);
fft_xt = fft_xt (1:length(fft_xt)/2);
figure;
stem(id,abs(fft_xt))
title('x(n) in terms of Frequency');
xlabel('Frequency (Hz)');
ylabel('Amplitude'),xlim([0,1000]);
Output:

Fig: Waveform of discrete output x(n) in frequency domain at sampling frequency=300 Hz


Fig: LTI system output signal with a sampling frequency of 300 Hz

Code:
LTI_output_fft = fft(LTI_output,length(LTI_output));
id = (300/length(LTI_output))*(0:length(LTI_output_fft)/2-1);
LTI_output_fft = LTI_output_fft(1:length(LTI_output_fft)/2);
figure;
stem(id,abs(LTI_output_fft))
title('Output of LTI system in terms of frequency');
xlabel('Frequency (Hz)'),ylabel('Amplitude'),xlim([0,2000]);

Output:
Fig: Output Signal of LTI System in frequency domain at sampling Frequency=300 Hz

All of these graphs demonstrate that at a very low sampling frequency of 300Hz, which is below
the Nyquist rate, we are unable to discriminate between the features of the input signal and the
characteristics of the output signal in the time domain.

Here, the sampling frequency is set to 90,000 Hz (above the Nyquist rate theorem) and is
increased:

Code:
Fs = 90000; % Sampling frequency
F1 = f1/Fs;
F2 = f2/Fs;
F3 = f3/Fs;
N = 1/F3;
n = 0 : 5*N; %Discrete values
% Adding discrete signals
discrete_xt=5*cos(2*pi*F1*n)+5*cos(2*pi*F2*n)+3*cos(2*pi*F3*n);
figure;
stem(n,discrete_xt);
title('Discrete Output = x(n)');
xlabel('Discrete values N'),ylabel('Amplitude');
Fig: Waveform of discrete output x(n) at sampling frequency=90,000Hz
Fig: Waveform of discrete output x(n) in frequency domain at sampling
frequency=90,000Hz
Fig: Output signal of LTI system at sampling Frequency=90000 Hz
Fig: Output Signal of LTI System in frequency domain at sampling Frequency=90000 Hz

All of the aforementioned graphs demonstrate that, even at sampling frequencies far higher than
the Nyquist rate, like 90000 Hz, it is simple to distinguish between the characteristics of the
input signal and the output signal in the time domain and confirm that they match.

Reconstruction of the signal:


Code:
figure;
a= ifft(LTI_output_fft);
stem(a);
title('Reconstructed signal by applying IFFT');
xlabel('N'),ylabel('Amplitude'),xlim([0,300]);
Since the output signal's noise level has dropped and it resembles the input signal visually, this
signal's properties are comparable to those of the input signal.

Suggestion:
To remove the noise from the output signal and obtain the transmitted signal, we can use a
band pass filter. In this case, attenuation is reducing the signal's amplitude just as it would in
practice. We may thus utilize the regenerative repeater to ignore the attenuation factor. We may
use a digital to analog converter to obtain the original time domain signal after receiving the LTI
system's output.

Discussion:
The goal of this project is to teach us how to combine signals, sample them, discretize analog
signals, send the discrete signals through a receiver, and finally reconstruct the original signal.
In order to transform an analog signal into a discrete signal, this project shows us how to
sample and combine signals. Each input signal's frequency was determined in order to imitate
the three signals. Following that, a sampler is used to discretize the summed signal. The
Nyquist theorem was then used to arrive at a sampling frequency of 30000, which is twice the
x(t) frequency. We looked at the signals' frequency representation using FFT. We then settle on
a sample frequency of 30000, which is twice the x(t) frequency, in accordance with the Nyquist
theorem. We utilized FFT to get the frequency representation of the signals. Then this discrete
signal is sent by radar with noise that is almost equal to a real-world scenario. B elements were
used to delay the radar's input, which had an attenuation value of 0.A. In our instance, (ID:
20321057), we determine that A=7 and B=1. Then the signal was added, resulting in a right shift
and a doubling of the attenuation factor. Then, beginning at n = 7, we produced random noise in
the same dimension as the input signal. Here, while introducing noise, we discuss several noise
and value-related difficulties. We then apply a distorted signal to an LTI system and examine the
output. The system's ROC must then be determined in order to confirm the stability of the
system. We also determined the dominant frequency component of the output by doing FFT on
the input and output signals. The dominant frequency is strongest in this area. In this instance,
using a lower sample frequency would prohibit us from attaining the necessary output stability.
We also measured the output by adjusting the sampler's frequency. We were able to learn about
and create a model of a real-world DSP scenario as a consequence of our investigation. We
found that a signal to be sent had several frequency components. When a signal is given with
noise, attenuation, delay, etc., we may calculate the impulse response (output) of an LTI system
using an impulse function. After that, we may specify the system output for an input signal using
the impulse response. It was difficult to identify the dominant frequency and create a zone of
convergence for this project. But in the end, we were able to locate the issue and fix it. We
continually observed the output in the temporal and frequency domains to gain a better
understanding. We had a great experience overall since this project gave us the chance to
address real-world problems. All of these conclusions essentially brought a stop to our
continuing project.

You might also like