EECE301: Signals and Systems
Signal Analysis using MATLAB
Project Deliverable I: Final Report
Group Members: ID: Major
Metrek Alajmi 43511 Computer
Abdullah Alostath 46496 Electrical
Abdullah Aladwani 46520 Electrical
Instructor: Dr. Wael Farag
Date: 1/8/2021
Section: O9
Summer 2021
Abstract:
Several methods are used to analyze linear time invariant systems. The purpose of our work
is to use the time-domain analysis and frequency domain analysis to find the system's
response y(t). We use the convolution and then use the reverse Fourier transformation
method to apply the Fourier theory to find the output y(t) in several ways. The two methods
seem to have essentially the same result. The only difference is the sharp edges that cause
the phenomenon of "Gibbs", caused by the abrupt change of the signal y(t). This usually
occurs when calculating numerically reverse Fourier transform. Finally, we perform a nice
convolution application where we find the least filter duration T such that 80% of the input
energy is preserved at the output y(t).
Page2
Contents
1. Introduction:.......................................................................................................................4
1.1. Problem Definition....................................................................................................5
1.2. Structure of the Report.............................................................................................6
2. Analysis and simulation........................................................................................................6
2.1. Background..............................................................................................................6
2.2. Analysis....................................................................................................................6
2.3. MATLAB code and figures.......................................................................................8
2.4. Discussion of the results........................................................................................13
3. Conclusion........................................................................................................................13
3.1. Summary of the work achieved..............................................................................13
3.2. Future work in order to enhance your work............................................................13
4. Reference.........................................................................................................................14
5. Appendices.......................................................................................................................15
Page3
1. Introduction:
Our goal in this work is to analyze a linear time-invariant (LTI) system. We do so in time
domain and in the frequency domain. We first find the output of the system analytically,
then we confirm our results through MATLAB simulations (numerically). We then make
use of the convolution theorem to find the output y in the time domain by find the
Fourier transforms of x and h, multiplying them and then perform an inverse Fourier
operation. We find that the obtained results agrees with the time-domain convolution
with the exception that a “Gibbs” phenomenon appears at the sharp transitions of the
signal. Finally, we find the minimum value of the duration T of the system, such that 80%
of the energy of x is preserved in the output.
1.1.Problem Definition
We are given the following LTI system:
The input signal x(t) is given by:
Page4
And the impulse response of the system h(t) is given by:
The goal of this problem is to analyze the system h(t), compute and plot the output y(t)
using time-domain convolution and Frequency domain multiplication and inverse
Fourier transform to verify that the two methods lead to the same results. After
analyzing the system with different methods (numerical, analytical), we design a system
h(t) such that the Energy of the output y(t) is at least 80% of the energy of the input x(t).
1.2.Structure of the Report
The organization of this report is as follows: In Section 2, we analyze the system in the
time domain and the frequency domain respectively, we find the results analytically and
confirm them with numerical simulations. Analytical results and discussions are
presented in section 2.2, whereas section 2.3 is reserved for the MATLAB code and plots
used to find the simulations. We conclude in Section 3.
Page5
2. Analysis and simulation
2.1.Background
In this project, we assume that the value of a = 11.
MATLAB makes it straight forward to perform the tasks of this project through its built-
in functions (for example conv, which computes the convolution between signals).
Through MATLAB, we verify our theoretical results using numerical simulations and
plots.
We make use of the theory learned in class to study an LTI system in the time domain
and frequency domain, and verify that the two results are in agreement.
2.2.Analysis
1) Value of | X ( w )|:
exp [ −( 11+ jw ) ]
+∞ ∞
X ( w )= ∫ x ( t ) exp (− jwt ) dt=∫ exp (−11t ) exp (− jwt ) dt =
−∞ 1 11+ jw
From which we get:
2 1 exp (−2∗11 )
| X ( w )| = X ( jw ) X ¿ ( jw )= 2 2
exp (−2∗11) exp (− jw ) exp ( jw ) = 2 2
11 + w 11 + w
And:
exp (−11 )
| X ( jw )|=
√121+ w2
2) Plot in section 2.3
3) y(t) is found using the convolution between x(t) and y(t):
∞
y ( t ) =x ( t )∗h ( t )= ∫ h ( τ ) x (t−τ ) dτ We know that h(.) is nonzero between 0 and 4, and x(.)
−∞
is nonzero only if t > 1.
Therefore we get:
- If t – 1 < 0:
y(t) = 0.
- If 0 < t – 1 < 4 1 < t < 5:
t −1 t −1 −11t
e
y (t)= ∫ e
−11 ( t−τ )
dτ=e
−11t
∫e 11τ
dτ= [ e 11 (t −1)−1 ]= 1 [ e−11−e−11 t ] .
y=0 0 11 11
- If t – 1 > 4 t > 5, We can compute the convolution as:
4 −11 t
e
y ( t ) =∫ e [ e 44 −1 ] .
−11 ( t −τ )
d τ=
0 11
We can plot the obtained signal using MATLAB (done in the section 2.3).
4) We use MATLAB to numerically compute the convolution result, using the function “conv”.
We find that the numerical plot of the convolution is the same as the analytical expression
found in the previous question.
Page6
5) To find y(t) using Fourier Transform, we jump into Fourier domain to find the transforms of
x(t) and h(t). Next, we perform multiplication of the two Fourier transforms to compute
Y(w), the Fourier transform of y(t). Then we estimate the output y(t) by estimating the
integral of the “inverse Fourier transform”.
6) The MATLAB figures are plotted in the next section.
7) Advantages of using Fourier domain over time domain:
a. The convolution theorem is usually useful to perform faster computations using FFT
and iFFT (instead of using the expensive direct convolution which is computationally
extensive).
b. The convolution is sometimes harder to visualize than the Fourier domain
multiplication.
c. Most of the times, a frequency plot is needed to see frequency contents that we do
not usually see from time-domain plots.
On the other hand, time domain analysis also presents some advantages compared to
Fourier domain analysis:
a. Some time-domain properties are hard to observe and conclude from a frequency-
domain plot.
b. The inverse Fourier transform is not very accurate. This is due to the sharp
transitions at the edges and hence the so called “Gibbs” phenomenon, where some
ripples are shown in the signal.
8) We can find that T ≥ 4.4800 seconds is at least required so that the energy of the input
signal is conserved. We can find the code in Section 2.3.
Page7
2.3.MATLAB code and figures
In this section, we plot the different figures for each of the parts.
1) Analytically:
% Assume value for a
a = 11;
% 1- Analytical method for computing abs(X(jw))
2) Numerical integration:
% 2- Numerical evaluation of abs(X(jw))
figure;
syms t w;
FT = int(exp(-a*t) * exp(-1i * w * t), t, 1, inf);
Page8
3) Analytical results of y(t) can be directly plotted using MATLAB:
% 3- plotting y(t), analytical evaluation
figure;
4) We can use “conv” in MATLAB to find the convolution numerically:
% 4- Plotting y(t), numerical convolution
figure;
t = -10:0.001:10;
Page9
5)
% 5- Plotting y(t), Fourier Transfrom and inverse Fourier
% Numerically estimate the Fourier transforms of X, H and Y using trapz
k = 0;
X_estimate = [];
H_estimate = [];
Y_estimate = [];
t = -10:0.001:10;
for w = -10:0.01:10
k = k + 1;
X_estimate(k) = trapz(t(t >= 1), exp(-1i * t(t >= 1) * w) .* exp(-a * t(t >= 1)));
H_estimate(k) = trapz(t(t >= 0 & t <= 4), exp(-1i * t(t >= 0 & t <= 4) * w));
end
Y_estimate = X_estimate .* H_estimate; % Convolution is product
% Then find numerically the inverse fourier transform of Y
figure;
k = 0;
y_estimate = [];
We get the following plot:
Page10
6) Drawing the two figures on the same plot, we get:
% 6- Draw both results on the same plot
figure;
t = -10:0.001:10;
x = [zeros(1, length(t(t<1))), exp(-a * t(t>=1))];
Page11
7) Discussed in the previous section.
8) We use the MATLAB code below to find the minimum value of T = 4.480 seconds:
% 8- Filter design (T = 4.4801 seconds)
T = 0.0001;
delta = 0.01;
t = -10:delta:10;
E1 = 0;
E2 = 0;
while E2 <= 0.8 * E1
2.4.Discussion of the results
We find from the plots that the numerical simulations are in agreement with the
analytical results. Moreover, we find that the output y(t) can be obtained in two
ways, using time-domain convolution and frequency domain Fourier transform.
When estimating y(t) from the latter method, we observe some sharp transitions
on the edges of y(t), causing some ripples at the edges of the signal.
Page12
In the last part, we observer that the duration of the filter must be at least 4.48
seconds for the energy of y to contain at least 80% of the energy of x.
3. Conclusion
3.1.Summary of the work achieved.
Several methods are used to analyze linear time invariant systems. The purpose of our
work is to use the time-domain analysis and frequency domain analysis to find the
system's response y(t). We used the convolution and then used the reverse Fourier
transformation method to apply the Fourier theory to find the output y(t) in several
ways. The two methods seem to have essentially the same result. The only difference is
Page13
the sharp edges that cause the phenomenon of "Gibbs", caused by the abrupt change of
the signal y(t). This usually occurs when calculating numerically reverse Fourier
transform. Finally, we perform a nice convolution application where we find the least
filter duration T such that 80% of the input energy is preserved at the output y(t).
3.2.Future work
In the future, this work can be enhanced by trying to use the fast Fourier transform
(FFT), to get a better estimate on the continuous time Fourier transform. This is useful
because the integral (int) and (trapz) functions of MATLAB can be numerically slow or
unstable, or both. This is clearly manifested in the ripples that we got while computing
the inverse Fourier transform to get y(t).
4. Reference
1. Hussain, Z. M., Sadik, A. Z., & O’Shea, P. (2011). Digital signal processing: an introduction
with MATLAB and applications. Springer Science & Business Media.
2. Orfanidis, S. J. (1995). Introduction to signal processing. Prentice-Hall, Inc..
3. Phillips, C. L., Parr, J. M., Riskin, E. A., & Prabhakar, T. (2003). Signals, systems, and
transforms (p. 209). Upper Saddle River: Prentice Hall.
4. Overman, E. (2011). A matlab tutorial. Dept. of Mathematics, Ohio State Univ., Columbus,
OH, 180.
5. Zhang, Z., & Yang, Z. (2015). MATLAB tutorial.
Page14
5. Appendices
Find the entire MATLAB script here:
% Assume value for a
a = 11;
% 1- Analytical method for computing abs(X(jw))
figure;
w = -20:0.01:20;
norm_X = exp(-a) ./ sqrt((a^2 + w.^2));
plot(w, norm_X);
grid on;
title('Plot of the Fourier transform (analytical)');
xlabel('w (rad / s)');
ylabel('|X(w)|');
% 2- Numerical evaluation of abs(X(jw))
figure;
syms t w;
Page15
FT = int(exp(-a*t) * exp(-1i * w * t), t, 1, inf);
assume(w, 'real');
norm_w = simplify(abs(FT));
w = -20:0.01:20;
plot(w, subs(norm_w));
grid on;
title('Plot of the Fourier transform (numerical)');
xlabel('w (rad / s)');
ylabel('|X(w)|');
% 3- plotting y(t), analytical evaluation
figure;
t = -10:0.01:10;
y_1 = zeros(1, length(t(t < 1)));
y_2 = 1/a * (exp(-a) - exp(-a * t(t >= 1 & t <= 5)));
y_3 = exp(-a*t(t > 5))/a * (exp(4 * a) - 1);
y_all = [y_1, y_2, y_3];
plot(t, y_all);
grid on;
title('convolution between x(t) and h(t) (analytical)');
% 4- Plotting y(t), numerical convolution
figure;
t = -10:0.001:10;
x = [zeros(1, length(t(t<1))), exp(-a * t(t>=1))];
h = [zeros(1, length(t(t<0))), ones(1, length(t(t>=0 & t <= 4))), ...
zeros(1, length(t(t>4)))];
y_numerical = conv(x, h, 'same') * 0.001;
plot(t, y_numerical);
grid on;
title('convolution between x(t) and h(t) (numerical)');
% 5- Plotting y(t), Fourier Transfrom and inverse Fourier
% Numerically estimate the Fourier transforms of X, H and Y using trapz
k = 0;
X_estimate = [];
H_estimate = [];
Y_estimate = [];
t = -10:0.001:10;
for w = -10:0.01:10
k = k + 1;
X_estimate(k) = trapz(t(t >= 1), exp(-1i * t(t >= 1) * w) .* exp(-a * t(t >= 1)));
H_estimate(k) = trapz(t(t >= 0 & t <= 4), exp(-1i * t(t >= 0 & t <= 4) * w));
end
Y_estimate = X_estimate .* H_estimate; % Convolution is product
% Then find numerically the inverse fourier transform of Y
figure;
k = 0;
y_estimate = [];
w = -10:0.01:10;
for t = -10:0.001:10
k = k + 1;
y_estimate(k) = trapz(w, 1/(2*pi) * exp(1i * w * t) .* Y_estimate);
end
plot(-10:0.001:10, y_estimate);
grid on;
title('y(t) by computing inverse FT');
% 6- Draw both results on the same plot
figure;
t = -10:0.001:10;
x = [zeros(1, length(t(t<1))), exp(-a * t(t>=1))];
h = [zeros(1, length(t(t<0))), ones(1, length(t(t>=0 & t <= 4))), ...
zeros(1, length(t(t>4)))];
y_numerical = conv(x, h, 'same') * 0.001;
plot(t, y_numerical);
hold on;
plot(t, y_estimate);
grid on;
legend({'Numerical plot of y(t)', 'Convolution theorem'});
Page16
% 8- Filter design (T = 4.4801 seconds)
T = 0.0001;
delta = 0.01;
t = -10:delta:10;
E1 = 0;
E2 = 0;
while E2 <= 0.8 * E1
T = T + 0.0001;
x = [zeros(1, length(t(t<1))), exp(-a * t(t>=1))];
h = [zeros(1, length(t(t<0))), ones(1, length(t(t>=0 & t <= T))), ...
zeros(1, length(t(t>T)))];
y = conv(x, h, 'same') * delta;
E1 = sum(abs(x.^2));
E2 = sum(abs(y.^2));
end
Page17