Assignment[3]
Assignment[3]
Computer Systems
College of Engineering and Technology
University of Sargodha
Signal and Systems
(EE-311)
Assignment # 03
Muntazir Mehdi
Student &
Name
M. Yousaf
ELEN51F22R007
Registration # &
ELEN51F22R009
Page: 1 of 2
Department of Electrical, Electronics and
Computer Systems
College of Engineering and Technology
University of Sargodha
General Instructions:
- Answer the following questions.
- By hand calculations must be followed by MATLAB codes.
- Code should be printed out, followed by the figure/results.
- Your plots/results will be marked based on clarity and appearance.
- Figures’ screenshots will not be accepted. Properly saved figures should be printed.
- This assignment covers CLO: 03 of the course.
Note: Each step should also be coded in MATLAB where −7 ≤ t ≤ 7 (sec) and keep
a step size of 0.001. Label the x-axis as Time (sec), y-axis as the signal you plot e.g.,
x (t+ 2) and it must change automatically with each entry e.g., if only time scaling is
performed then it should be x (at ), where a is the scaling unit, if only magnitude
shifting is performed then k + x (t ) and so on.
Page: 2 of 2
Department of Electrical, Electronics and
Computer Systems
College of Engineering and Technology
University of Sargodha
Remember the LineWidth should be exactly 2. If you plot more plots on the same figure then
differentiate them with different colours, markers and legend on an optimal position. Font to be
used for the title and labels is “Times New Roman”.
The axis (x and y-axis) must be positioned at the origin and ticks must adopt with the signal e.g.,
ymax = max(x(t))+1 and ymin = min(x(t))+1.
Page: 3 of 2
Department of Electrical, Electronics and
Computer Systems
College of Engineering and Technology
University of Sargodha
Introduction:
Signal processing plays a vital role in the field of engineering, especially
in the analysis, manipulation, and transformation of signals. In this
assignment, we explore the basic operations that can be applied to signals:
time reversal, time shifting, and time scaling. Understanding these
transformations is fundamental for analyzing signals and designing
systems that process them. These operations help us understand how
signals behave when subjected to changes, such as moving them in time or
stretching/compressing them in time.
The goal of this assignment is to apply these transformations to a given
signal and generate corresponding plots using MATLAB. By doing so, we
will develop a clearer understanding of the effects of these transformations
on the signal’s appearance. This will further help us grasp the core
principles of signal processing that are applicable to more complex
systems.
MATLAB Code Explanation:
Below is the MATLAB code used to implement the operations on the
given signal x(t)x(t)x(t). The code generates plots for the original signal as
well as its transformed versions. The transformations we apply are time
reversal, time shifting, and time scaling. Each plot is formatted according
to the assignment instructions.
Code:
t = -7:0.001:7;
% x(t)
Page: 4 of 2
Department of Electrical, Electronics and
Computer Systems
College of Engineering and Technology
University of Sargodha
Signal = x_t(t);
ymin = -1;
ymax = 2;
%x(t)
figure;
subplot(2,1,1);
grid on;
%x(-t)
signal_neg = x_t(-t);
subplot(2,1,2);
grid on;
%x(t)
figure;
subplot(2,1,1);
grid on;
Page: 5 of 2
Department of Electrical, Electronics and
Computer Systems
College of Engineering and Technology
University of Sargodha
ylabel('Amplitude', 'FontName', 'Times New Roman');
%x(t+2)
signal_shifted = x_t(shiftedTime);
subplot(2,1,2);
grid on;
%x(t)
figure;
subplot(2,1,1);
grid on;
%x(2t+2)
signal_scaled = x_t(scaledTime);
subplot(2,1,2);
grid on;
Page: 6 of 2
Department of Electrical, Electronics and
Computer Systems
College of Engineering and Technology
University of Sargodha
title('x(2t+2)', 'FontName', 'Times New Roman');
%x(t)
figure;
subplot(2,1,1);
grid on;
%x(1-3t)
scaledTime = -3 * t;
transformedTime = 1 + scaledTime;
signal_transformed = x_t(transformedTime);
subplot(2,1,2);
grid on;
Page: 7 of 2
Department of Electrical, Electronics and
Computer Systems
College of Engineering and Technology
University of Sargodha
Transformations:
1. Time Reversal: The signal x(−t) is created by flipping the signal around the
vertical axis (time reversal).
2. Time Shifting: The signal x(t+2) shifts the signal 2 units to the right.
3. Time Scaling and Shifting: The signal x(2t+2)scales the time by a factor of 2
and shifts it by 2 units.
4. Complex Scaling and Shifting: The signal x(1−3t) scales the time by -3 and
shifts the result by 1 unit.
Plotting: The subplot function is used to create a figure with two subplots: the first
subplot shows the original signal, and the second subplot shows the transformed signal.
The xlim and ylim functions ensure the axis is appropriately set to capture the entire
signal, with gridlines enabled for clarity.
Formatting: The title, labels, and font are set according to the given requirements. The X
and Y axes are positioned at the origin for better visual clarity.
Page: 8 of 2
Department of Electrical, Electronics and
Computer Systems
College of Engineering and Technology
University of Sargodha
Page: 9 of 2
Department of Electrical, Electronics and
Computer Systems
College of Engineering and Technology
University of Sargodha
Page: 10 of 2
Department of Electrical, Electronics and
Computer Systems
College of Engineering and Technology
University of Sargodha
Page: 11 of 2
Department of Electrical, Electronics and
Computer Systems
College of Engineering and Technology
University of Sargodha
Page: 12 of 2
Department of Electrical, Electronics and
Computer Systems
College of Engineering and Technology
University of Sargodha
Page: 13 of 2
Department of Electrical, Electronics and
Computer Systems
College of Engineering and Technology
University of Sargodha
Conclusion:
In this assignment, we explored the basic signal operations of time reversal, time shifting,
and time scaling. Using MATLAB, we applied these transformations to a simple signal x(t),
which provided a visual representation of how each operation alters the signal.
Time Reversal: Flipping the signal around the vertical axis reflects the behaviour of the
signal over time.
Time Shifting: Shifting the signal along the time axis illustrates how signals can be
delayed or advanced in time.
Time Scaling and Shifting: Scaling and shifting the time axis shows how signals can be
compressed, stretched, or moved in both time and amplitude.
Through these exercises, we gained valuable insight into the behaviour of signals under
various transformations, which is essential for more advanced signal processing applications.
Understanding these transformations helps in the analysis and design of systems that process
signals in practical engineering scenarios.
Page: 14 of 2