Signals and systems Lab 1
Denzel Onyango Ninga ENG-219-042/2022
March 2025
1 Abstract
In this lab report, I will be able to analyze and explain the plots of specific
signals: signum, rectangular, triangular, sinc, impulse, step, square, discrete
exponential, and discrete cosine.I will also analyze the relationship between
frequencies for discrete cosine and exponential signals. I will State and verify
the Cauchy-Schwarz inequality, Classify systems based on linearity, time-
invariance, causality, and stability and perform advanced signal operations
and analyze their properties.By use of MATLAB plot and calculate these ,
I’ll verify.
2 Introduction
First off, a signal is a function representing a physical quantity or variable
and a system is a mathematical model of a physical process that relates the
input signal to the output signal. The origin of the word systems dates back
to the 15th century, when it was used as a Latin word systema, which means
the entire universe.1 Signal and system concepts arise in a wide variety of ar-
eas, from home-oriented consumer electronics and multimedia entertainment
products to sophisticated communications, aeronautics and astronautics, and
control. Of course, signals and systems are the entire universe, prove me
wrong! Signals and systems are the backbone of communication.
1
Fatoş Tunay Yarman Vural and Emre Akbaş, Signals and Systems: Theory and Prac-
tical Explorations with Python (CRC Press, 2022), p. 19.
1
2.1 Lab Objectives
The objectives of this lab are:
• Understand and plot specific signals: signum, rectangular, triangular,
sinc, impulse, step, square, discrete exponential, and discrete cosine.
• Use subplots to analyze the relationship between frequencies for dis-
crete cosine and exponential signals.
• Calculate inner products of signals and use them to compute energy
and power, comparing hand calculations with code results.
• State and verify the Cauchy-Schwarz inequality.
• Classify systems based on linearity, time-invariance, causality, and sta-
bility.
• Perform advanced signal operations and analyze their properties.
3 Methodology
Most of this lab was completing the skeleton codes provided in the Lab
Manual ’Signal and System Analysis Lab 1’.I did this using MATLAB R2024b
and I did use alternatives for certain codes since I just did not have certain
toolboxes such as the rectangular Toolbox, so I used Rectangular function
alternatively for rectangularPulse, but believe me ,you! It was a success. I
ran all my codes in the live script in MATLAB, ran each section separately,
making the necessary changes to ensure it was a success and of course it was.
Also, I did the hand calculations and verified the results.It was rough here
as I was involved with finding the inner product and calculating the catchy-
schwartz inequalities, thanks to Indian YouTubers-they are geniuses.The
YouTube channel The grade Academy ,video titled ’Real Analysis lecture
10 -catchy-schwartz inequality Proof’ was a life saver.2 The methodology
included:
• Running MATLAB codes to generate and analyze signal plots.
2
The Grade Academy, Real Analysis Lecture 10 - Cauchy-Schwarz Inequality
Proof,YouTube,Published on[2021],https://youtu.be/i851HnlBpv8?si=HBe9MPFa9HZwLYDF,accessed
on [18/3/2025].
2
• Reading necessary materials,including Textbooks to understand various
concepts and just to cross check them.
• Watching YouTube videos to grasp the underlying concepts.
• Performing hand calculations to verify MATLAB results and ensure
theoretical accuracy.
• Researching the internet and using online tools to understand concepts
,while ensuring it is never misused.
4 Results
The results after completing or even making necessary improvements to the
MATLAB skeleton codes were as follows;
4.1 MATLAB Code
The MATLAB code used in this lab is provided below It contains the full
implementation for generating and analyzing the signals:
3
Exercise 1: Plotting Specific Signals
Tasks: Plot the continuous-time (CT) signals and discrete-time (DT) signals
using subplots. Complete the missing trit_t and sinc_t functions.
% Continuous-Time (CT) Signals
t = -5:0.01:5;
% Signum function
sgn_t = sign(t);
% Rectangular function (Alternative for rectangularPulse)
rect_t = double(abs(t) <= 0.5);
% Triangular function
tri_t = (1 - abs(t)) .* (abs(t) <= 1);
% Sinc function (Using MATLAB's built-in sinc function)
sinc_t = sinc(t);
% Plot CT signals
figure;
subplot(2,2,1); plot(t, sgn_t); title('Signum Function');
subplot(2,2,2); plot(t, rect_t); title('Rectangular Function');
subplot(2,2,3); plot(t, tri_t); title('Triangular Function');
subplot(2,2,4); plot(t, sinc_t); title('Sinc Function');
1
% Discrete-Time (DT) Signals
n = -10:10;
% Impulse function
delta_n = (n == 0);
% Step function
u_n = (n >= 0);
% Square impulse (nonzero for n = 0,1,2,3,4)
square_n = (n >= 0) & (n < 5);
% Discrete exponential
exp_n = exp(1j * pi * n / 5);
% Discrete cosine (added as a missing subplot)
cos_n = cos(pi * n / 5);
% Plotting DT signals in a 2x3 grid so that all signals are visible.
figure;
subplot(2,3,1); stem(n, delta_n, 'filled'); title('Impulse Function');
subplot(2,3,2); stem(n, u_n, 'filled'); title('Step Function');
subplot(2,3,3); stem(n, square_n, 'filled'); title('Square Impulse');
2
subplot(2,3,4); stem(n, real(exp_n), 'filled'); title('Discrete
Exponential');
subplot(2,3,5); stem(n, cos_n, 'filled'); title('Discrete Cosine');
Exercise 2: Frequency Analysis Using Subplots
Tasks: Implementing exp_k and exp_l for discrete exponential signals.
N = 10;
n = 0:N-1;
k = 2;
l = N - k;
% Discrete Cosine signals
cos_k = cos(2*pi*k*n/N);
cos_l = cos(2*pi*l*n/N);
% Discrete Exponential signals
exp_k = exp(1j * 2 * pi * k * n / N);
exp_l = exp(1j * 2 * pi * l * n / N);
% Plot Cosine signals
3
figure;
subplot(2,1,1); stem(n, cos_k, 'filled'); title(['Cosine: k = ',
num2str(k)]);
subplot(2,1,2); stem(n, cos_l, 'filled'); title(['Cosine: l = ',
num2str(l)]);
% Plot Exponential signals (real parts)
figure;
subplot(2,1,1); stem(n, real(exp_k), 'filled'); title(['Exponential: k = ',
num2str(k)]);
subplot(2,1,2); stem(n, real(exp_l), 'filled'); title(['Exponential: l = ',
num2str(l)]);
4
Exercise 3: Completing Inner Products, Energy, and Power
Tasks: Compute inner products, energy of signals, power of periodic signals,
verify the Cauchy-Schwarz inequality.
% Discrete-Time (DT) Inner Product
n = 0:9;
x_dt = cos(2*pi*n/10);
y_dt = sin(2*pi*n/10);
inner_dt = sum(x_dt .* conj(y_dt));
% Display DT inner product result
fprintf('DT Inner Product = %.16f\n', inner_dt);
DT Inner Product = -0.0000000000000001
% Continuous-Time (CT) Inner Product
t = 0:0.01:1;
x_ct = sin(2*pi*t);
y_ct = cos(2*pi*t);
5
inner_ct = trapz(t, x_ct .* conj(y_ct)); % Using trapz for numerical
integration
% Display CT inner product result
fprintf('CT Inner Product = %.16f\n', inner_ct);
CT Inner Product = 0.0000000000000000
% Energy Calculation
% DT Energy
energy_x_dt = sum(abs(x_dt).^2);
energy_y_dt = sum(abs(y_dt).^2);
% CT Energy
energy_x_ct = trapz(t, abs(x_ct).^2);
energy_y_ct = trapz(t, abs(y_ct).^2);
% Display Energy Results
fprintf('DT Energy of x_dt = %.16f\n', energy_x_dt);
DT Energy of x_dt = 4.9999999999999991
fprintf('DT Energy of y_dt = %.16f\n', energy_y_dt);
DT Energy of y_dt = 5.0000000000000009
fprintf('CT Energy of x_ct = %.16f\n', energy_x_ct);
CT Energy of x_ct = 0.5000000000000000
fprintf('CT Energy of y_ct = %.16f\n', energy_y_ct);
CT Energy of y_ct = 0.5000000000000000
% Power Calculation (Average energy over time)
power_x_ct = energy_x_ct / (max(t) - min(t));
power_x_dt = energy_x_dt / length(n);
% Display Power Results
fprintf('CT Power of x_ct = %.16f\n', power_x_ct);
CT Power of x_ct = 0.5000000000000000
fprintf('DT Power of x_dt = %.16f\n', power_x_dt);
DT Power of x_dt = 0.4999999999999999
% Verify Cauchy-Schwarz Inequality
cauchy_schwarz_dt = abs(inner_dt) <= sqrt(energy_x_dt * energy_y_dt);
cauchy_schwarz_ct = abs(inner_ct) <= sqrt(energy_x_ct * energy_y_ct);
6
% Display Cauchy-Schwarz Results
disp(['Cauchy-Schwarz DT holds: ', num2str(cauchy_schwarz_dt)]);
Cauchy-Schwarz DT holds: 1
disp(['Cauchy-Schwarz CT holds: ', num2str(cauchy_schwarz_ct)]);
Cauchy-Schwarz CT holds: 1
Exercise 4: System Classifications
Tasks: Check Linearity and Time-Invariance for CT and DT systems.
Check Causality and Stability of given systems.
% Linearity and Time-Invariance (CT)
t = 0:0.01:5;
x1 = sin(2*pi*t);
x2 = cos(2*pi*t);
y1 = x1 + circshift(x1, 100);
y2 = x2 + circshift(x2, 100);
y3 = x1 + x2 + circshift(x1 + x2, 100);
is_linear_ct = isequal(y1 + y2, y3);
% Linearity and Time-Invariance (DT)
n = 0:50;
x1_dt = sin(2*pi*n/10);
x2_dt = cos(2*pi*n/10);
y1_dt = x1_dt + circshift(x1_dt, 10);
y2_dt = x2_dt + circshift(x2_dt, 10);
y3_dt = x1_dt + x2_dt + circshift(x1_dt + x2_dt, 10);
is_linear_dt = isequal(y1_dt + y2_dt, y3_dt);
% Causality and Stability
% For CT System: Integral from -∞ to t (example representation)
syms tau t_sym;
x_tau = exp(-tau);
y_t = int(x_tau, tau, -inf, t_sym); % This is an example; in practice, a CT
system's causality is determined by its impulse response.
% For DT System: Summation from -∞ to n (example representation)
syms k n_sym;
x_k = k^2;
y_n = symsum(x_k, k, -inf, n_sym); % Example sum (diverges, but used here
illustratively)
% Checking causality (using the signal domains)
is_causal_ct = all(t >= 0); % System is causal if t >= 0 (for t vector
defined earlier)
7
is_stable_ct = energy_x_ct < inf; % System is stable if it has finite energy
is_causal_dt = all(n >= 0); % System is causal if n >= 0
is_stable_dt = energy_x_dt < inf; % System is stable if it has finite energy
% Display system classification results
disp(['System is Linear (CT): ', num2str(is_linear_ct)]);
System is Linear (CT): 0
disp(['System is Linear (DT): ', num2str(is_linear_dt)]);
System is Linear (DT): 0
disp(['System is Causal (CT): ', num2str(is_causal_ct)]);
System is Causal (CT): 1
disp(['System is Causal (DT): ', num2str(is_causal_dt)]);
System is Causal (DT): 1
disp(['System is Stable (CT): ', num2str(is_stable_ct)]);
System is Stable (CT): 1
disp(['System is Stable (DT): ', num2str(is_stable_dt)]);
System is Stable (DT): 1
8
5 Discussions and Observations
5.1 Exercise 1: Plotting Specific Signals
5.1.1 1) Continuous-Time (CT) Signals
The following were the results after running the codes for the continuous-time
signals.
Figure 1: Continuous-Time functions plots
1. Signum Function From the graph of the signum function, it can be
observed that the output jumps to +1 for positive values of the signal and
dips to -1 for the negative values. This implies that the signum function is
used to show whether a signal is positive or negative. The word itself, signum,
comes from a Latin word meaning “mark.” It is an odd mathematical function
which extracts the sign of a real number.
1 t>0
sgn(t) = 0 t=0
−1 t < 0
These conditions basically prove the math representing the signum func-
tion. Thus, the lab verified this behavior successfully.
Applications of Signum Function:
12
• Detecting the change of signs.
• Zero crossing in signal processing.
2. Rectangular Function Observing the rectangular function, it is seen
that the signal is rectangular shaped with a height of 1. If a center line is
drawn along its width, it passes through t = 0. The rectangular signal is also
known as the unit pulse. Moreover, it is an even function of time because it
satisfies x(t) = x(−t).
1
|t| ≤ 0.5
rect(t) =
0 otherwise
Applications of Rectangular Function:
• Used as a base shape (pulse) for sending bits over a channel.
3. Triangular Function The triangular function from the plots clearly
shows a shape with linear slopes. It is also an even function of time, satisfying
x(t) = x(−t). A typical definition is:
1 − |t| |t| ≤ 1
tri(t) =
0 otherwise
Applications of Triangular Function:
• Used in signal analysis due to its frequency properties (e.g., filtering
and interpolation).
4. Sinc Function From the plots, the sinc function shows a clear central
peak at t = 0, where its value is 1, and oscillations that diminish symmetri-
cally on either side. It is defined as:
sin(πt)
sinc(t) = .
πt
This function is even and is crucial in sampling theory.
Advantages of Sinc Function:
• Even symmetric nature and oscillatory properties are beneficial in mod-
ulation schemes.
13
Disadvantages of Sinc Function:
• Infinite support (oscillates indefinitely), which can be problematic in
practical implementations.
Applications of Sinc Function:
• Used in signal analysis, filtering, and interpolation in communications.
5.1.2 2) Discrete-Time (DT) Signals
The following were the results after running the codes for the discrete-time
signals.
Figure 2: Discrete-Time Functions Plots
14
1. Impulse Function From the graph, the impulse function has only one
nonzero value at n = 0, which is equal to 1. Otherwise, it is zero everywhere
else. Hence, it is often called the unit impulse function.
1 n=0
δ[n] =
0 otherwise
Applications of Impulse Function:
• Deriving the impulse response of a system to understand how systems
process different signals.
2. Step Function This function suddenly rises to 1 at n = 0 and remains
there for n ≥ 0. It is zero for negative n.
1n≥0
u[n] =
0 n<0
Applications of Step Function:
• Modeling sudden changes in a system, such as switching on/off.
3. Square Impulse Function The amplitude of this signal remains 1
from n = 0 to n = 4, otherwise 0, creating a block or pulse shape in the
discrete domain.
Applications of Square Impulse:
• Modeling time-limited signals in digital communications.
4. Discrete Exponential Function The real part oscillates between
positive and negative values while maintaining a constant magnitude of 1 on
the unit circle in the complex plane.
Applications of Discrete Exponential:
• Basis for complex exponentials in Fourier analysis and digital commu-
nications.
15
5. Discrete Cosine Function It can be observed that the discrete co-
sine and discrete exponential functions have the same frequencies. This was
verified through plots and theoretical analysis.
Summary of Exercise 1: Both DT and CT plots confirmed the theo-
retical and mathematical descriptions, demonstrating success in generating
and understanding these signals.
5.2 Exercise 2: Frequency Analysis Using Subplots
5.2.1 1. Discrete Cosine
Figure 3: Discrete cosine Function Plot
Comparing two discrete cosine signals with k = 2 and l = 8, the plots
appear identical. Due to the periodic nature of discrete signals, l = 8 is
equivalent to k = −2. This demonstrates frequency symmetry in the discrete
domain.
k+l =N ⇒ 2 + 8 = 10
verifying DFT symmetry properties.
16
5.2.2 2. Discrete Exponential
Similarly, the discrete exponential signals with k + l = N show that they rep-
resent the same frequency but with different phase shifts, indicating mirrored
frequencies.
Figure 4: Discrete Exponential Plot
5.3 Exercise 3: Inner Products and Energy
1. Inner Product For DT signals, the inner product of cos(2πn/10) and
sin(2πn/10) was nearly zero (floating-point precision gave a very small resid-
ual). For CT signals, it was exactly zero. This confirms their orthogonality.
2. Energy and Power By hand calculations and MATLAB code, the
energy of x(t) = sin(2πt) was 0.5, and its power was also 0.5. The DT
signals also matched the theoretical values.
3. Cauchy-Schwarz Inequality The code confirmed the inequality holds
for both CT and DT signals, indicating numerical computations are consis-
tent with theory.
17
5.4 Exercise 4: System Classifications
1. Linearity and Time-Invariance For the systems y(t) = x(t)+x(t−1)
(CT) and y[n] = x[n] + x[n − 1] (DT), linearity failed. Time-invariance also
failed due to the shifted term, as confirmed by MATLAB code.
2. Causality and Stability - Causality: The outputs depend only on
present and past values (not future), making the systems causal. - Stability:
BIBO stability was verified since the system’s energy was finite and the code
returned true (1).
5.5 Additional Questions
Question 1: Hand Calculations for Inner Products These matched
the code results, confirming correctness.
Question 2: Energy and Power Calculations Again, hand calculations
aligned with code outputs (e.g., 0.5 for CT signals).
Question 3: Cauchy-Schwarz Inequality Verified numerically and the-
oretically.
Question 4: System Classifications Already discussed in Exercise 4.
Question 5: Frequency Analysis Comprehensive analysis was done in
Exercise 2, verifying the frequency symmetry for k and l.
5.6 Practical Applications in Electrical Engineering
Practical applications as seen in the discussion part include;
• Signal Operations:
– Modulation and Filtering: Signal operations such as addition,
convolution, and Fourier transforms are used to design modula-
tors and filters in telecommunications thus allowing recovery of
communication signals eg from noise.
18
– Noise Reduction and Data Processing: Operations on signals
like scaling and summing are used in process and clean signals in
areas such as audio processing and data communication.
• System Classifications:
– Control and Automation:Types of systems such as linear or
non-linear, time-invariant or time-variant, and causal or non-causal
are used to design robust control systems.
– Reliability in Communications: Analyzing system stability
and causality ensures that communication systems operate reli-
ably, such that the outputs depend on the inputs and remain
bounded.
• Inner Products:
– Signal Orthogonality and Decomposition: Inner products
are used in determining the orthogonality between signals,i.e how
much they are rhyming a key concept for Fourier analysis and
used in signal decomposition.
– Energy and Power Calculations: Inner products are used to
calculate the energy and power of a signal thus ensuring safety in
transmitting and processing signals.
This applications have been proved in this lab report as observed in the
Discussion section.
6 Conclusion
This lab provided a comprehensive exploration of signals and systems, com-
bining theoretical analysis with practical implementation. By completing
this lab, I gained a deeper understanding of signal properties, operations,
and system classifications. I now have the ability to verify theoretical results
using computational tools. All this Lab ran successfully as the objectives
were achieved and the codes were implemented successfully.
19
7 References
References
[1] Martin Wafula. (2025). Signals and Systems Lab Manual. Course Mate-
rial.
[2] Li, G. (2020). Signals and Systems. Springer.
[3] Yarman Vural, F. T. (2022). Signals and Systems: Theory and Practical
Explorations with Python. CRC Press.
[4] Oppenheim, A. V., Willsky, A. S., Nawab, S. H. (1996). Signals and
Systems (2nd ed.). Prentice Hall.
20