0% found this document useful (0 votes)
3 views

Assignment[3]

This document is an assignment for the Signals and Systems course at the University of Sargodha, focusing on basic operations on signals and their visualization using MATLAB. It includes instructions for hand calculations and MATLAB coding, detailing transformations such as time reversal, shifting, and scaling. The assignment aims to enhance understanding of signal behavior through practical applications and visual representation of these transformations.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Assignment[3]

This document is an assignment for the Signals and Systems course at the University of Sargodha, focusing on basic operations on signals and their visualization using MATLAB. It includes instructions for hand calculations and MATLAB coding, detailing transformations such as time reversal, shifting, and scaling. The assignment aims to enhance understanding of signal behavior through practical applications and visual representation of these transformations.
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 14

Department of Electrical, Electronics and

Computer Systems
College of Engineering and Technology
University of Sargodha
Signal and Systems
(EE-311)
Assignment # 03

Department of Electrical, Electronics and Computer Systems


College of Engineering and Technology
University of Sargodha
Course Instructor: Dr . Imran Khan

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

Subject: Signals and Systems (EE-311) Assignment No: 03


Title: Basic Operations on Signals and Plotting Tools Semester: 5th
Date: 11 November 2024 Due Date: 25 November 2024
Teacher: Dr. Imran Khan Yousufzai

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.

Q # 01:- Sketch the following for x (t) given in the figure?


a. x (−t )
b. x (t +2 )
c. x (2 t +2 )
d. x (1−3 t)

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.

Figure.1: Sample Figure

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)

x_t = @(t) (t >= 0 & t < 3) .* (1 - t/3);

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);

plot(t, Signal, 'b-', 'LineWidth', 2);

grid on;

title('x(t)', 'FontName', 'Times New Roman');

xlabel('Time (sec)', 'FontName', 'Times New Roman');

ylabel('Amplitude', 'FontName', 'Times New Roman');

xlim([-10 10]); ylim([ymin ymax]);

ax = gca; ax.XAxisLocation = 'origin'; ax.YAxisLocation = 'origin';

%x(-t)

signal_neg = x_t(-t);

subplot(2,1,2);

plot(t, signal_neg, 'r-', 'LineWidth', 2);

grid on;

title('x(-t)', 'FontName', 'Times New Roman');

xlabel('Time (sec)', 'FontName', 'Times New Roman');

ylabel('Amplitude', 'FontName', 'Times New Roman');

xlim([-10 10]); ylim([ymin ymax]);

ax = gca; ax.XAxisLocation = 'origin'; ax.YAxisLocation = 'origin';

%x(t)

figure;

subplot(2,1,1);

plot(t, Signal, 'b-', 'LineWidth', 2);

grid on;

title('x(t)', 'FontName', 'Times New Roman');

xlabel('Time (sec)', 'FontName', 'Times New Roman');

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');

xlim([-10 10]); ylim([ymin ymax]);

ax = gca; ax.XAxisLocation = 'origin'; ax.YAxisLocation = 'origin';

%x(t+2)

shiftedTime = t + 2; % Shift the signal by +2

signal_shifted = x_t(shiftedTime);

subplot(2,1,2);

plot(t, signal_shifted, 'g-', 'LineWidth', 2);

grid on;

title('x(t+2)', 'FontName', 'Times New Roman');

xlabel('Time (sec)', 'FontName', 'Times New Roman');

ylabel('Amplitude', 'FontName', 'Times New Roman');

xlim([-10 10]); ylim([ymin ymax]);

ax = gca; ax.XAxisLocation = 'origin'; ax.YAxisLocation = 'origin';

%x(t)

figure;

subplot(2,1,1);

plot(t, Signal, 'b-', 'LineWidth', 2);

grid on;

title('Plot 3: x(t)', 'FontName', 'Times New Roman');

xlabel('Time (sec)', 'FontName', 'Times New Roman');

ylabel('Amplitude', 'FontName', 'Times New Roman');

xlim([-10 10]); ylim([ymin ymax]);

ax = gca; ax.XAxisLocation = 'origin'; ax.YAxisLocation = 'origin';

%x(2t+2)

scaledTime = 2 * t + 2; %shift by 2 and Scale by 2

signal_scaled = x_t(scaledTime);

subplot(2,1,2);

plot(t, signal_scaled, 'm-', 'LineWidth', 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');

xlabel('Time (sec)', 'FontName', 'Times New Roman');

ylabel('Amplitude', 'FontName', 'Times New Roman');

xlim([-10 10]); ylim([ymin ymax]);

ax = gca; ax.XAxisLocation = 'origin'; ax.YAxisLocation = 'origin';

%x(t)

figure;

subplot(2,1,1);

plot(t, Signal, 'b-', 'LineWidth', 2);

grid on;

title('Plot 4: x(t)', 'FontName', 'Times New Roman');

xlabel('Time (sec)', 'FontName', 'Times New Roman');

ylabel('Amplitude', 'FontName', 'Times New Roman');

xlim([-10 10]); ylim([ymin ymax]);

ax = gca; ax.XAxisLocation = 'origin'; ax.YAxisLocation = 'origin';

%x(1-3t)

scaledTime = -3 * t;

transformedTime = 1 + scaledTime;

signal_transformed = x_t(transformedTime);

subplot(2,1,2);

plot(t, signal_transformed, 'k-', 'LineWidth', 2);

grid on;

title('Plot 4: x(1-3t)', 'FontName', 'Times New Roman');

xlabel('Time (sec)', 'FontName', 'Times New Roman');

ylabel('Amplitude', 'FontName', 'Times New Roman');

xlim([-10 10]); ylim([ymin ymax]);

ax = gca; ax.XAxisLocation = 'origin'; ax.YAxisLocation = 'origin';

Explanation of the Code:


 Signal Definition: The original signal x(t) is defined using an anonymous function that
specifies a linearly decreasing function from 1 to 0 for 0≤t<3. This is a basic example of
a piecewise signal, which is a common form used in signal processing.

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

You might also like