Course Number: EEE343L Project Report: BRAC University Semester-Fall 2022
Course Number: EEE343L Project Report: BRAC University Semester-Fall 2022
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
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.
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:
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.
Output:
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:
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:
Output:
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:
Noise:
Code:
noise=(n>=7).*rand([1,length(n)]);
figure;
stem(n,noise),title("Generated random noise"),xlabel("N"),ylabel("Amplitude");
Output:
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
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.
Here, we can see a delay at the signal's beginning as expected, and the output signal likewise
conforms to our predictions.
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.
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]);
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:
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.
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.