0% found this document useful (0 votes)
24 views63 pages

Signals and Systems-3150912-Lab Manual

Lllllllllll

Uploaded by

merpankesh3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
24 views63 pages

Signals and Systems-3150912-Lab Manual

Lllllllllll

Uploaded by

merpankesh3
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 63

A Laboratory Manual for

Signals and Systems


(3150912)

B.E. Semester 5 (Electrical)

Vishwakarma Government Engineering College,


Chandkheda

Directorate of Technical Education, Gandhinagar,


Gujarat
Vishwakarma Government Engineering College
Chandkheda – Ahmedabad
Certificate
This is to certify that Mr./Ms. ___________________________________
________ Enrollment No. _______________ of B.E. Semester 5 Electrical
Engineering of this Institute (GTU Code: 017 ) has satisfactorily completed the
Practical / Tutorial work for the subject Signals and Systems (3150912) for
the academic year 2022-23.

Place: __________
Date: __________

Name and Sign of Faculty member

Head of the Department


Practical – Course Outcome matrix
Course Outcomes (COs):
CO-1: Describe the type of system and signal at the Industries and Domestic level for Interfacing.
CO-2 Derive a mathematical model of the systems and signals for the applications.
CO-3 Analyze the response of the system for the efficient usage of the systems.
CO-4 Design of the system from the available input signals and expected output signals of the industrial
model.

Sr.
Objective(s) of Experiment CO1 CO2 CO3 CO4
No.

To perform basic operations on Matrices using


1. √
MATLAB/Simulink Software.
To demonstrate different types of signals using VLAB and
2. MATLAB √
To do different operations on continuous time signals.
3. √

To check different properties of given systems.


4. √

To perform convolution of continuous-time signals.


5. √

To find laplace transform and inverse laplace transform √


6.
using MATLAB.
To compute the fourier series of given signals. √
7.

To perform fourier transform and inverse fourier √


8.
transform of a given signal / sequence .
To perform z transform and inverse z transform √
9.

To compute unit sample, unit step and sinusoidal


10. √
response of the given LTI system
Signals and Systems (3150912)

Industry Relevant Skills

The following industry relevant competency are expected to be developed in the student by
undertaking the practical work of this laboratory.
1. Allow one to predict, with some certainty, the behavior of systems when they are subjected to
different input signals.
2. The mathematical approach also allows one to design electrical circuits or algorithms that will
operate on signals in such a way so as to produce desirable outcomes.

Guidelines for Faculty members


1. Teacher should provide the guideline with demonstration of practical to the students
with all features.
2. Teacher shall explain basic concepts/theory related to the experiment to the students before
starting of each practical
3. Involve all the students in performance of each experiment.
4. Teacher is expected to share the skills and competencies to be developed in the
students and ensure that the respective skills and competencies are developed in the
students after the completion of the experimentation.
5. Teachers should give opportunity to students for hands-on experience after the
demonstration.
6. Teacher may provide additional knowledge and skills to the students even though not
covered in the manual but are expected from the students by concerned industry.
7. Give practical assignment and assess the performance of students based on task
assigned to check whether it is as per the instructions or not.
8. Teacher is expected to refer complete curriculum of the course and follow the
guidelines for implementation.

Instructions for Students


1. Students are expected to carefully listen to all the theory classes delivered by the faculty
members and understand the COs, content of the course, teaching and examination scheme,
skill set to be developed etc.
2. Students shall organize the work in the group and make record of all observations.
3. Students shall develop maintenance skill as expected by industries.
4. Student shall attempt to develop related hand-on skills and build confidence.
5. Student shall develop the habits of evolving more ideas, innovations, skills etc. apart from
those included in scope of manual.
6. Student shall refer technical magazines and data books.
7. Student should develop a habit of submitting the experimentation work as per the schedule
and s/he should be well prepared for the same.
Signals and Systems (3150912)

Index
(Progressive Assessment Sheet)
Sr. Objective(s) of Experiment Page Date of Date of Assessme Sign. of Remar
No. No. perform submiss nt Teacher ks
ance ion Marks with date
1 To perform basic operations on Matrices
using MATLAB/Simulink Software.
2 To demonstrate different types of signals using
VLAB and MATLAB
3 To do different operations on continuous time
signals.
4
To check different properties of given systems.
5 To perform convolution of continuous-time
signals.
6 To find Laplace transform and inverse Laplace
transform using MATLAB.
7 To compute the Fourier series of given signals.

8 To perform Fourier transform and inverse


Fourier transform of a given signal / sequence
9 To perform z transform and inverse z
transform
10 To compute unit sample, unit step and
sinusoidal response of the given LTI system
Total
Signals and Systems (3150912)

Experiment 0

Vision of DTE

1. To provide globally competitive technical education;


2. Remove geographical imbalances and inconsistencies;
3. Develop student friendly resources with a special focus on girls’ education and support to
weaker sections;
4. Develop programs relevant to industry and create a vibrant pool of technical professionals.

Vision & Mission of Institute


Vision
To be a leading institution ensuring Academic Excellence, Research, Nurturing Innovation and
Entrepreneurial Attitude to produce competent technocrats for service to Nation.
Mission

1. To be a student centric institute imbibing experiential, innovative and lifelong learning skills,
addressing societal problems.
2. To create a conducive ecosystem for Research, innovation & extension services.
3. To inculcate entrepreneurial attitude and values amongst Learners.
4. To Collaborate with Industries and other institutions to strengthen symbiotic relations.
5. To mentor aspiring Institutions to unleash their potential, towards nation building.

Core Values
Our core values are quality, equality, morality, environmental sustainability, energy saving and
strong commitment to the cause of technical education and services. We believe and put efforts
towards:

 Equitable and harmonious growth of students, staff, society, industry.


 Quality services and education to train students enlightened with vision to be commited
citizen with strong civic sense and high moral standards having concern for local and global
values.

Vision & Mission of Department


Vision
To thrive for excellence in the field of Electrical Engineering by imparting quality education that
produces skilled, innovative and ethical engineers to meet the needs of academia, industry and
society.
Mission

 To provide an effective Teaching -Learning environment to acquire skills and knowledge


in the field of Electrical Engineering.
 Strengthen industry institute interaction to enable the students to work on innovative and
real time problems.
 To foster a culture of entrepreneurship amongst the students.
 To instill values in students for lifelong learning and service to the society.
Signals and Systems (3150912)

Program Outcomes as defined by NBA (PO)

Engineering Graduates will be able to:

1. Engineering knowledge: Apply the knowledge of mathematics, science, engineering


fundamentals, and an engineering specialization to the solution of complex engineering problems.
2. Problem analysis: Identify, formulate, review research literature, and analyze complex
engineering problems reaching substantiated conclusions using first principles of mathematics,
natural sciences, and engineering sciences.
3. Design/development of solutions: Design solutions for complex engineering problems and
design system components or processes that meet the specified needs with appropriate
consideration for the public health and safety, and the cultural, societal, and environmental
considerations.
4. Conduct investigations of complex problems: Use research-based knowledge and research
methods including design of experiments, analysis and interpretation of data, and synthesis of the
information to provide valid conclusions.
5. Modern tool usage: Create, select, and apply appropriate techniques, resources, and modern
engineering and IT tools including prediction and modeling to complex engineering activities with
an understanding of the limitations.
6. The engineer and society: Apply reasoning informed by the contextual knowledge to assess
societal, health, safety, legal and cultural issues and the consequent responsibilities relevant to the
professional engineering practice.
7. Environment and sustainability: Understand the impact of the professional engineering
solutions in societal and environmental contexts, and demonstrate the knowledge of, and need for
sustainable development.
8. Ethics: Apply ethical principles and commit to professional ethics and responsibilities and
norms of the engineering practice.
9. Individual and team work: Function effectively as an individual, and as a member or leader in
diverse teams, and in multidisciplinary settings.
10. Communication: Communicate effectively on complex engineering activities with the
engineering community and with society at large, such as, being able to comprehend and write
effective reports and design documentation, make effective presentations, and give and receive
clear instructions.
11. Project management and finance: Demonstrate knowledge and understanding of the
engineering and management principles and apply these to one’s own work, as a member and
leader in a team, to manage projects and in multidisciplinary environments.
12. Life-long learning: Recognize the need for, and have the preparation and ability to engage in
independent and life-long learning in the broadest context of technological change.

Program Educational Objectives (PEOs)


The Graduates will be able to

1. Design, model, analyze and provide appropriate solutions to the industry based problems.
2. Demonstrate entrepreneurial skills and lifelong learning during the career.
3. Adapt themselves with the new technological challenges.
4. Exhibit professional leadership skills imbibing ethical practices.
5. Contribute idea with effective communication and work in a team to develop projects and
plans.
Signals and Systems (3150912)

Program Specific Outcomes (PSO)


PSO 1: Utilize the domain knowledge cultivated from courses of Electrical Engineering
encompassing Analysis, Control, Protection, Design of Electrical Machines and Power Systems.
PSO 2: Evaluate the existing system and provide technical solutions to meet the societal needs.
Signals and Systems (3150912)

Experiment No: 1
BASIC OPERATIONS ON MATRICES

Date:

Competency and Practical Skills: Basic knowledge of Matrices

Relevant CO: CO1 :Describe the type of system and signal at the Industries and Domestic level for
Interfacing

Objectives: To perform basic operations on Matrices using MATLAB/Simulink Software.


Equipment/Instruments: PC with Windows (95/98/XP/NT/2000). MATLAB Software

Theory: A high-performance language for technical computing.


Typical uses of MATLAB:
 Mathematical computations.
 Algorithmic development.
 Model prototyping (prior to complex model development).
 Data analysis and exploration of data (visualization).
 Scientific and engineering graphics for presentation.
 Complex analysis using MATLAB toolboxes (i.e., statistics,
 neural networks, fuzzy logic, H-infinity control, economics, etc.)

Why MATLAB is Important?

Because it simplifies the analysis of mathematical models.

 It frees you from coding in high-level languages (saves a lot of time - with
some computational speed penalties)
 Provides an extensible programming/visualization environment.
 Provides professional-looking graphs.
 Provide a lot of toolboxes that help me.
 MATLAB is usually faster than Mathematica and Maple in numeric-intensive
tasks.
 MATLAB has more textbooks than other packages combined (350+ books).
Perhaps this speaks of the acceptance by the user community.

Introduction:

The name is MATLAB stands for Matrix Laboratory. MATLAB was written originally
to provide easy access to matrix software developed by the LINPACK (linear system
Signals and Systems (3150912)

package) and EISPACK (Eigen system package) projects.


 MATLAB is a high-performance language for technical computing. It integrates
computation, visualization, and programming environment. Furthermore,
MATLAB is a modern programming language environment: it

has sophisticated data structures, contains built-in editing and debugging tools, and supports
object-oriented programming
 MATLAB has many advantages compared to conventional computer languages
(e.g., C, FORTRAN) for solving technical problems.
 MATLAB is an interactive system whose basic data element is an array that
does not require dimensioning.
 It has powerful built-in routines that enable a very wide variety of computations.
It also has easy-to-use graphics commands that make the visualization of results
immediately available. Specific applications are collected in packages referred
to as toolbox. There are toolboxes for signal
 processing, symbolic computation, control theory, simulation, optimization,
Neural networks, Fuzzy logic, communications and various fields of applied
science and engineering.

Starting MATLAB
One can enter MATLAB by double-clicking on the MATLAB shortcut icon on a
Windows desktop. Upon starting of MATLAB, a special window called the MATLAB
desktop appears. The desktop is a window that contains other windows. The major tools
within or accessible from the desktop are:

 The Command Window: the window in which the inputs and out puts can be
observed.
 The Command History: the window consisting of the instruction given in the
command during the previous sessions.
 The Workspace: the window consisting of the variables used in the programming.
 The Current Directory: the directory consisting of m-files and other files of
use/work.
Signals and Systems (3150912)

Variable:
A MATLAB variable is an object belonging to a specific data type. On MATLAB
variable is basically a matrix. Matrices can be made up of real or complex numbers, as
well as characters (ASCII symbols).
Defining MATLAB Variables
In general, the matrix is defined in the MATLAB command interface by input from the
keyboard and assigned a freely chosen variable name in accordance with the following
syntax:
>> x = 2.45
With this instruction, after a MATLAB prompt the number 2.45 (a number is a 1 × 1
matrix) will be assigned to the variable x and can subsequently be addressed under this
variable name. All of the defined variables will be stored in the so-called workspace of
MATLAB.
Rules for Variable Names
 MATLAB (beyond 7 Version) will support the variable names with 63
characters
 The names of variables can be of the alphabetical and numerical combinations
 The names of the variables should not start with numbers
 While naming a variable, make sure we are not using a name that is already
used as a function name.
 MATLAB reserves certain keywords for its own use and does not allow
overriding them. Hence the reserved key words can’t be used as variables.
 Special characters such as hyphen, % and other sign are not allowed to use as
variable names.
 MATLAB is case sensitive; hence ALPHA and alpha are treated as separate
variables.
Signals and Systems (3150912)

Plotting
Plotting is one of the most useful applications of a math package to plot experimental
or generated data
Basic 2 D plotting:
Plotting a function in MATLAB involves the following three steps:
1. Define the function
2. Specify the range of values over which to plot the function
3. Call the MATLAB plot(x, y) function
Example:
Define the function

For plotting the function y= cos(x) over a range of 0≤x≤pi

Specify the range of values over which to plot the function

To start, we have to define this interval and tell MATLAB what increment to use. The
interval is defined using square brackets [ ] that are filled in the following manner:
Syntax: [start: interval: end]
Example: x=0: pi/10:2* pi
To assign this range to a variable name, we use the assignment operator. We also do
this to tell MATLAB what the dependent variable is and what function we want to plot.
Hence the command y = cos(x), returns the values of cos(x) to the variable y for the
values of x:
Call plot(x, y) function
Now we can plot the function by entering the following command in the command
window:
>> Plot(x, y)
After a moment MATLAB will open a new window on the screen with the caption
Figure 1. The plot is found in this window.

>> x = [0:pi/10:2*pi];

>> y = cos(x);

Fig. 2: Plotting the data


Signals and Systems (3150912)

Options of 2D plotting:
 Adding grid lines to the plot We can add the axis lines(grid) on the plot by using
a command grid next to the plot command,
 Adding labels to the plot: plotting the plot having labels can be done using the
label and label instructions. These functions can be used with a single argument,
the label you want to use for each axis enclosed in quotes. Place the x- label and
y label functions separated by commas on the same line as your plot command.
For example, the following text generates the plot shown in
 >> x = [0:pi/10:2*pi];
 >> y = cos(x);
 >> plot(x,y);

Titles can be added to the plot by using the function title („Title of the plot „)
 Adding axis command: MATLAB allows us to adjust the axes used in two-
dimensional plots in the following way
 Adding an axis square to the line containing the plot command, will
cause MATLAB to generate a square plot.
 Adding an axis equal, then MATLAB will generate a plot that has the
same scale factors and tick spacing on both axes.
 To set the plot for a user-defined range call the function axis in the
following way: axis([xmin xmax ymin ymax])
 Multiple plots: To plot multiple functions, we simply call the plot(x, y)
command with multiple pairs x, y defining the independent and dependent
variables used in the plot in pairs. This is followed by a character string enclosed
in single quotes to tell us what kind of line to use to generate the second curve.
In this case, we have:
>> plot (t1, f, t2, g);
Where t1 and f represent one the set of data, similarly t2 and g represent another
set of data points.
Signals and Systems (3150912)

 Adding legend: when more than two or more plots were plotted on the same
figure window, know which curve is which it is required the discriminate the
plots which can be done using the function legend (‘series1’,’series2’,’series3’)
 Adding colors: The color of each curve can be set automatically by MATLAB
or we can manually select which color we want. This is done by enclosing the
appropriate letter assigned to each color used by MATLAB in single quotes
immediately after the function to be plotted is specified. Let’s illustrate with an
example.
For plotting the first series in red color with dashed lines and the second
series with dot-dashed- in blue color.
>> plot (t1, f, ’r--’, t2, g, ‘b.-’);

Polar plots: MATLAB supports plotting the calculated data onto polar plots
For example, let’s generate a spiral. The so-called spiral of Archimedes is defined by
the simple relationship:
r = a𝜃
Where a is some constant. Let’s generate a polar plot of this function for the case where a
= 2 and 0 ≤ 𝜃 ≤ 2𝜃. The first statement is to assign a value to the variable a:

>> a = 2;
Now let’s define the range of (𝜃).
>> theta = [0:pi/10:2*pi];
Now let’s define the function r (𝜃).
>> r = a*theta;
The call to generate a polar plot is:
polar (theta, r)

Fig. 4: Plotting the polar plot


Signals and Systems (3150912)

Logarithmic and semi-logarithmic plots


Logarithmic and semi-logarithmic plots can be generated using the commands loglog,
semi log, and semilogy. The use of the above plot commands is similar to those of the
plot command
The description of these commands is as follows:
Log log(x, y) - generates a plot of log10(x) versus log10(y)

semilogx(x, y) - generates a plot of log10(x) versus linear axis of y

semilogy(x, y) - generates a plot of linear axis of x versus log10(y)

Script and Functions:


Script files (m-File):
The commands in the Command Window cannot be saved and executed again. Also,
the Command Window is not interactive. To overcome these difficulties, the procedure
is first to create a file with a list of commands, save it and then run the file. In this way,
the commands contained are executed in the order they are listed when the file is run.
In addition, as the need arises, one can change or modify the commands in the file; the
file can be saved and run again. The files that are used in this fashion are known as
script files.
Thus, a script file is a text file that contains a sequence of MATLAB commands. The
script file can be edited (corrected and/or changed) and executed many times.
Creating and Saving a Script File
Any text editor can be used to create script files. In MATLAB, script files are created
and edited in the Editor/ Debugger Window. This window can be opened from the
Command Window. From the Command Window, select File, New, and then M-file.
Once the window is open, the commands of the script file are typed line by line.
Example of a script file
x = 0:pi/100:2*pi; y1 =
2*cos(x);
y2 = cos(x);
y3 = 0.5*cos(x);
Plot(x,y1,'--',x,y2,'-',x,y3,':')
xlabel('0 \leq x \leq 2\pi') ylabel('Cosine
functions')
legend ('2*cos(x)','cos(x)','0.5*cos(x)') title ('Typical example of
multiple plots') axis ([0 2*pi -3 3])
Signals and Systems (3150912)

Functions: functions are programs (or routines) that accept input arguments and return
output arguments.
Anatomy of a M-File function
 Function m-files must start with the keyword function, followed by the output
variable(s), an equals sign, the name of the function, and the input variable(s).
 If there is more than one input or output argument, they must be separated by
commas. If there are one or more input arguments, they must be enclosed in
brackets, and if there are two or more output arguments, they must be enclosed in
square brackets. The following illustrates these points (they are all valid function
definition lines):
function [output]=function name(input arguments
 Function names must follow the same rules as variable names. The file name is the
function name with “.m” appended. If the file name and the function name are
different, Matlab uses the file name and ignores the function name. You should use
the same name for both the function and the file to avoid confusion.
Logical Operators:
o &&: Logical AND with shortcut evaluation.
If the first expression is false, return false instead of calculating the second expression.
It works only between scaler values.
Faster because of partial evaluation.
o &: Logical AND
Evaluates both expressions.
It works with both scaler and array values.
o ||: Logical inclusive OR with shortcut evaluation.
If the first expression is true, return true instead of calculating the second expression
It works only between scaler values.
Faster because of partial evaluation.
o |: Logical OR
Evaluates both expressions.
It works with both scaler and array values.
o XOR: Logical exclusive OR
It returns true if and only if one operand is true and the other is false.
Signals and Systems (3150912)

Example:1
a = 10;
b = 20;
c=a+b
d=a-b
e=a*b
f=a/b
g=a\b
x = 7;
y = 3;
z=x^y

Ans.:

Example:2
b=[4,5;6,7] and c= [5,8;9,8]
perform following operations using MATLAB.
b+c, b-c , b.^c, b./c, b.\c , b>c, c>b , c==b, 'd'<'a'
Signals and Systems (3150912)

Example:3
e=7 and f=6, g=0
perform the following operations using MATLAB.
e&&f, e||f, e&&g, f||g, xor(e,f)

Conclusion:

Quiz:
1. Write applications of MATLAB .

2. List out various MATLAB functions and files.

3. Write down the main parts of MATLAB system.

4. Write down the function of any two MATLAB command

Rubric-wise marks obtained:


Rubrics 1 2 3 4 5 Total
Understanding of Compatibility of Regularity of Conclusion Participation (10)
MATLAB (2 Marks) MATLAB Submission and (2 Marks)
Coding (2 (2 Marks) Applications
Marks) (2 Marks)

Marks
Signals and Systems (3150912)

Experiment No: 2
DEMONSTRATE DIFFERENT TYPES OF SIGNALS

Date:

Competency and Practical Skills: Basic Knowledge about types of Signals

Relevant CO: CO1: Describe the type of system and signal at the Industries and Domestic level for
Interfacing

Objectives: To demonstrate different types of signals using VLAB and MATLAB


Equipment/Instruments: PC with Windows (95/98/XP/NT/2000). MATLAB Software

Theory:

Definition of Signal:
Any time-varying physical phenomenon that can convey information is called a signal. Some
examples of signals are human voice, electrocardiogram, sign language, videos, etc. There are
several classifications on of signals such as Continuous-time signal, discrete time signal and digital
signal, random signals and non-random signals.
Continuous-time Signal:
A continuous-time signal is a signal that can be defined at every instant of time. A continuous-
time signal contains values for all real numbers along the X-axis. It is denoted by x(t). Figure 1(a)
shows continuous-time signal.

Fig.1 (a) Continuous-time signal Fig.1 (b) Discrete-time signal

Discrete-time Signal:
Signals that can be defined at the discrete instant of time is called discrete time signal. Basically
discrete time signals can be obtained by sampling a continuous-time signal. It is denoted
as x(n).Figure 1(b) shows discrete-time signal.

Digital Signal:
Signals and Systems (3150912)

The signals that are discrete in time and quantized in amplitude are called digital signal. The term
"digital signal" applies to the transmission of a sequence of values of a discrete-time signal in the
form of some digits in the encoded form.

Periodic and Aperiodic Signal:

A signal is said to be periodic if it repeats itself after some amount of time x(t+T)=x(t), for some
value of T. The period of the signal is the minimum value of time for which it exactly repeats
itself.

Fig.2(a) Periodic signal Fig.2(b) Aperiodic signal

Signal which does not repeat itself after a certain period of time is called aperiodic signal. The
periodic and aperiodic signals are shown in Figure 2(a) and 2(b) respectively.

Random and Deterministic Signal:

A random signal cannot be described by any mathematical function, where as a deterministic


signal is one that can be described mathematically. A common example of random signal is noise.
Random signal and deterministic signal are shown in the Figure 3(a) and 3(b) respectively.

Sinusoidal signals y(t) = cos(t), 0 ≤ t ≤ 10


Code Comments Results

t=0:0.01:10; Time (the independent


variable t) is defined by
using a very small step
(time step = 0.01) in the
continuous domain 0 ≤
t ≤ 10.

y=cos(t); The dependent variable


y(t) is defined in the
continuous set of values
Signals and Systems (3150912)

-1≤ y(t) ≤ 1

plot(t,y); The analog signal is


drawn by using the
command plot

Fig. 1.1: Sinusoidal signal

Plot the signal x(t) = 3cos(3πt+π/3) in four periods.

Code Comments Results

A=3; The amplitude of the signal


is 3

ω = 3 π; The angular frequency is 3π

α = π/3; The phase is π /3.

T=2*π/ ω; The period is 2/3

t=0:0.01:4*T; The time is defined from 0


to 4T Fig. 1.2: Sinusoidal signal

x = A*cos(ω*t+α) Signal definition.

plot(t,x) The signal is plotted in time


of four periods.

Exponential signals Plot the signals x(t) = 3e0.4t and y(t) = 2e-0.9t in the time interval
- 2 ≤ t ≤ 5.

Code Comments Results

A=3; The amplitude of the x


signal is 3

B=2; The amplitude of the y


signal is 2

t=-2:0.1:5; Time is defined by using a


very small step in the
continuous domain -2 ≤ t ≤ Fig. 1.3: Exponential signals
5.

x=A*exp(0.4*t); Representation of
Signals and Systems (3150912)

exponential signals
y=B*exp(-0.9*t);

plot(t,x,t,y,‟:‟) The signal are plotted

legend(„x(t)‟,‟y(t)‟) Legends are printed

Step signal Plot unit step signal in the time interval -5 ≤ t ≤ 10.
Method1
With use of the command heaviside.

Code Comments Results

t=-5:0.1:10; Definition of time intervel

u= Definition of time u(t)


heaviside(t);

plot(t,u) The signal is plotted

Method 2 Use of piecewise functions.

t1=-5:0.1:0; Definition of the first time


interval 5≤ t ≤ 0.

t2=0:0.1:10; Definition of the second Fig. 1.4: Step signal


time interval 0 ≤ t ≤10

u1=zeros(size(t Implementation of the part


1)); of u(t) that corresponds to
time t1.

u2=ones(size(t Implementation of the part


2)); of u(t) that corresponds to
time t2.

t=[t1 t2]; Concatenation of the two


time vectors.

u=[u1 u2]; Concatenation of the two


function vectors.
Signals and Systems (3150912)

plot(t,u) Graph of the unit step


function u(t) in the time
interval 0 ≤ t≤ 10

Method 2 Implementation with


specific number of zeros
and ones

t=-5:0.1:10 Time definition

u= The vector t consists of 151


[zeros(1,50) elements. Thus, the first 50 Fig. 1.5: Step signal
ones(1,101)]; elements of t are matched
with zeros while the next
101 elements (including t =
0) of t are matched with
ones. The two vectors are
concatenated

plot(t,u) The signal is plotted

ylim([0.3 1.3]) Y limits are changed

Unit impulse or Dirac Delta

Code Comments Results

t1=-5:.1:-0.1; Definition of the first time


interval -5 ≤ t < 0

t2= 0; The second time interval is


defined only for one time
instance, namely for t = 0.

t3= 0.1:.1:10; Definition of the third time


interval 0 < t ≤ 10.

d1= Implementation of the part


zeros(size(t1)); (vector of one element) of d(t)
that corresponds to time t1
Fig. 1.6: Unit impulse
d2= 1; Implementation of the part
(vector of one
element) of d(t) that
corresponds to time t2

d3 Implementation of the part of


=zeros(size(t3)); d(t) that corresponds to time t3.

t = [t1 t2 t3]; Concatenation of the three time


vectors.
Signals and Systems (3150912)

D = [d1 d2 d3]; Concatenation of the three


function vectors.

plot(t,d) Graph of the Dirac function


d(t).

Method2

t =-5:.1:10; Definition of time.

s =gauspuls(t) Definition of the unit impulse

plot(t,d) Graph of the Dirac function


d(t).

d = dirac(t) Graph of d(t). Notice that at the Fig. 1.7: Unit impulse
time instance t = 0 there is a
gap in the graph that denotes
infinity.

plot(t,d) Graph of the Dirac function


d(t).
Signals and Systems (3150912)

Unit ramp signal

Code Comments Results

t1=-5:.1:-0.1; Definition of the first time


interval -5 ≤ t < 0

t2= 0.1:.1:10; Definition of the second time


interval 0 < t ≤ 10.

r1 = The first part of r(t) that


zeros(size(t1));b corresponds to time t1 is
constructed

r2 = t2; The second part of r(t) that


corresponds to time t2 is
constructed Fig. 1.8: Unit ramp signal

t = [t1 t2]; Time concatenation

r =[r1 r2]; Function concatenation

plot(t,r) Graph of the ramp function


r(t)

Method2

t =-5:.1:10; Definition of time.

R Definition of the unit ramp


=t.*heaviside(t);

plot(t,r) Graph of the Dirac function


r(t).
Signals and Systems (3150912)

Periodic signals

Code Comments Results

[s,t] Squares pulses that are


=gensig('square',3,20,0.01) repeated with period T
=3, time duration t =20,
plot(t,s) and sampling time ts =
0.01 s.
ylim([.3 1.3]) Graph of the defined
periodic signal. Indeed
the square pulses are Fig. 1.9: Square signal
repeated every T = 3 s.

[s,t] =gensig('pulse',2,10); Unit pulses repeated


with period T = 2 over
the time interval 0 ≤ t≤
plot(t,s)
10.

ylim([.3 1.3])
Graph of repeated unit
pulses.
Fig. 1.10: Pulse signal

t = 0:0.1:20; Definition of a triangle


wave for 0 ≤ t≤ 20.

s = sawtooth(t); Indeed the period is T


= 2p, while the signal
takes values in [1,1]
plot(t,s);

ylim([1.3 1.3]) Fig. 1.11: Sawtooth signal


Signals and Systems (3150912)

Simulation Results:

Conclusion:

Quiz:
1. Why we need to study about signals?

2. What are the different classifications of signals?

3. Define basic signals and their physical significance.


Signals and Systems (3150912)

Rubrics 1 2 3 4 5 Total
Understanding of Compatibility of Regularity of Conclusion Participation (10)
MATLAB (2 Marks) MATLAB Submission and (2 Marks)
Coding (2 Marks) Applications
(2 Marks) (2 Marks)

Marks
Signals and Systems (3150912)

Experiment No: 3
DIFFERENT OPERATIONS ON CONTINUOUS-TIME SIGNALS
Date:

Competency and Practical Skills: Basic knowledge about signal operations

Relevant CO: CO-3: Analyze the response of the system for the efficient usage of the systems

Objectives: To do different operations on continuous time signals.

Equipment/Instruments: PC with windows (95/98/XP/NT/2000). MATLAB Software

Theory:
Addition of two signals

Code Comments Results

t = 0:.1:6*pi; Time definition (T =2 π to


3T = 6π).
The signal x(t).
x=
cos(t)+sin(3*t); From the graph of x(t)
one can see that x(t) is
plot(t,x) indeed periodic with
period T =2 π.
Fig. 2.1: Addition of two signals

Even and odd signals


Code Results
t = 0:.1:5;
x = t.*exp(t);

xe = 0.5*t.*(exp(t)-
exp(t));

xo =
0.5*t.*(exp(t)+exp(t));

subplot(221);
plot(t,x);

subplot(222);
plot(t,xe);

subplot(223);
plot(t,xo); Fig. 2.2: Even and odd signals
subplot(224);
plot(t,xe+xo);
Signals and Systems (3150912)

Suppose that x(t) = t* cos(2 π t), 0 ≤ t ≤ 5.

Plot the signals x(t), x(-t), x(t/5), x(1 +3t) , x( -1-3t)

t = 0:0.01:5;
plot(-t,x)
x
=t.*cos(2*pi*t); legend('x(-t)');

plot(t,x);
Fig. 2.3: Operations on Fig. 2.4: Operations on
signals signals
legend('x(t)');

plot(5*t,x) plot( (1/3)*(-


1+t),x)

legend('x(t/5)');
legend('x(1+3t)');
Fig. 2.5: Operations on Fig. 2.6: Operations on
signals signals

plot(-(1/3)*(1+t),x)

legend('x(-1-
3t)');

Fig. 2.7: Operations on


signals

x(t) = t*e-t, -1 ≤ t ≤ 3.

t = -1 ≤ t ≤ 3;
plot(-t,x)
x = t.*exp(-t);
legend('x(-t)');
plot(t,x);
Fig. 2.8: Operations on Fig. 2.9: Operations on
signals signals
legend('x(t)');
Signals and Systems (3150912)

a = 2; a = 1/2;
plot( (1/a)*t,x) plot(
legend('x(2t)'); (1/a)*t,x)
legend('x(1/2t
)');
Fig. 2.10: Operations on Fig. 2.11: Operations on
signals signals

t0 = -3;
plot(t+t0,x)
t0 = 2;
legend('x(t+3)
plot(t+t0,x)
');
legend('x(t-2)');

Fig. 2.12: Operations on Fig. 2.13: Operations on


signals signals

plot(t-1,x) plot(0.5*(t-
legend('x(t+1)') 1),x)
legend('x(2t-
1)')

Fig. 2.15: Operations on


Fig. 2.14: Operations on signals
signals

plot(-0.5*(t-
1),x)
legend('x(1-2t)'

Fig. 2.16: Operations on


signals
Signals and Systems (3150912)

Result:

Addition of signals

Multiplication of signals

Subtraction of signals

Amplitude and time scaling of signals

Odd and Even components of a signal


Signals and Systems (3150912)

Conclusion:

Quiz:
1. Give difference between CT and DT.

2 Give examples of CT and DT signals.

Rubrics 1 2 3 4 5 Total
Understanding of Compatibility of Regularity of Conclusion Participation (10)
MATLAB (2 Marks) MATLAB Submission and (2 Marks)
Coding (2 Marks) Applications
(2 Marks) (2 Marks)

Marks
Signals and Systems (3150912)

Experiment No: 4
PROPERTIES OF SYSTEMS

Date:

Competency and Practical Skills: Basic knowledge about properties of Systems

Relevant CO: CO-3: Analyze the response of the system for the efficient usage of the systems

Objectives: To check different properties of given systems.

Equipment/Instruments: PC with Windows (95/98/XP/NT/2000). MATLAB Software

Theory:
Causal and Non-causal Systems
Suppose that a system S1 is described by the i/o relationship y(t) = x(t + 1) while the
i/o relationship of a system S2 is given by y(t) = x(t-1). Using the input signal x(t) =
u(t)-u(t -1) find out if the two systems are causal.

Code Results Comments

t1 = -3:.1:0; Definition and graph in


x1 the time interval 3 ≤ t ≤ 3
=zeros(size(t1)); of the input signal
t2 = 0:.1:1; x(t) = u(t)
x2 = u(t-1) = 1, 0 ≤ t ≤ 1
ones(size(t2)); 0, elsewhere
t3 = 1:.1:3;
x3 =
zeros(size(t3));
t = [t1 t2 t3];
x = [x1 x2 x3];
plot(t,x);
ylim([0.1 1.1]);

plot(t-1,x) The output of S1 is given


ylim([-0.1 1.1]); by y(t) = x(t + 1).
legend('y_1(t)') Inference: The input x(t)
is zero for t < 0 but the
output y(t) is nonzero for
< 0, i.e., y(t) depends on
future values of x(t); thus
system S1 is not causal.
Signals and Systems (3150912)

plot(t+1,x) The output of S2 is given


ylim([-0.1 1.1]); by y(t) = x(t - 1).
legend('y_2(t)') Inference: The output is
zero for t < 1, i.e., y(t)
depends only on past
values of x(t); thus system
S2 is causal.

Fig. 3.1: Causal and Non-causal Systems


Signals and Systems (3150912)

Static (Memoryless) and Dynamic (with Memory) Systems

Using the input signal x(t) = u(t) - u(t - 1) find out if the systems described by the i/o
relationships y(t) = 3x(t) is static or dynamic.

Code Results Comments

t1 = -3:.1:0; Definition and graph in


x1 =zeros(size(t1)); the time interval 3 ≤ t ≤ 3
t2 = 0:.1:1; of the input signal
x2 = ones(size(t2)); x(t) = u(t) -u(t-1) = 1, 0
t3 = 1:.1:3; ≤t≤ 1
x3 = zeros(size(t3)); 0, elsewhere
t = [t1 t2 t3];
x = [x1 x2 x3];
plot(t,x);
ylim([0.1 1.1]);

The output of the system


with i/o relationship
plot(t,3*x);
Fig. 3.2: Static (Memoryless) and
ylim([-0.1 3.1]); Dynamic (with Memory) Systems y(t) = 3x(t)
legend('y(t)') .

Linear and Nonlinear Systems


Hint: For linear S{a1x1(t) + a2x2(t)} = a1S{x1(t)} + a2S{x2(t)}

Let x1(t) = u(t) - u(t - 1) and x2(t) = u(t) - u(t - 2) be input signals to the systems
described by the i/o relationships y(t) = 2*x(t) and y(t) = x2(t). Determine if the linearity
property holds for these two systems. To examine if the systems are linear, we use the
scalars a1 = 2 and a2 = 3. The time interval considered is 3 ≤ t ≤ 3. For the system
described by the i/o relationship y(t) = 2x(t) the procedure followed is

Code Results Comments


t =-3:.1:3; Definition of the input
x1 = heaviside(t)- signals x1(t) and x2(t).
heaviside(t-1);
x2 = heaviside(t)-
heaviside(t-2);
a1 = 2; a2 = 3; The expression
z = a1*x1+a2*x2; a1x1(t)+a2x2(t) is defined.
y = 2*z; S{a1x1(t)+a2x2(t)} is
plot(t,y); computed and the result is
ylim([-1 11]); plotted
Signals and Systems (3150912)

z1 =2*x1; Definition of S{x1(t)} and


z2 = 2*x2; S{x2(t)}.
y =a1*z1þa2*z2;
plot(t,y); a1S{x1(t)} + a2S{x2(t)}, is
ylim([1 11]); computed and the
result is plotted
.
Fig. 3.3: Linear and Nonlinear
Systems

Inference: Examine if the linearity property holds for the system with i/o relationship y(t) = x2(t).

Code Results Comments

t =-3:.1:3; Definition of the input


signals x1(t) and x2(t).
x1 = heaviside(t)-
heaviside(t-1);
x2 = heaviside(t)-
heaviside(t-2);

a1 = 2; The expression a1x1(t)+a2x2(t)


a2 = 3; is defined.
z = a1*x1+a2*x2;

y = z2; S{a1x1(t)+a2x2(t)} is computed


plot(t,y); and the result is plotted
ylim([-1 26]);

z1 = x1.^2; Definition of S{x1(t)} and


Fig. 3.4: Linear and Nonlinear
z2 = x2.^2; Systems
S{x2(t)}.

y = a1*z1+a2*z2;
plot(t,y); a1S{x1(t)} + a2S{x2(t)}, is
ylim([1 6]);. computed and the result is
plotted

.
Signals and Systems (3150912)

Time-Invariant and Time-Variant Systems

Consider a system described by the i=o relationship y(t) = x(2t). Find out if this is a
time invariant system by using the input signal x(t) = u(t + 2) u(t - 2).

Code Results Comments

t = -5:.1:10; The input signal x(t) =u(t +


2) - u(t - 2).
x = heaviside(t+2) -
heaviside(t-2);
plot(t,x);
ylim([.1 1.1]); The system response y(t) =
x(2t) to the input signal x(t)
plot( (1/2)*t,x); = u(t + 2)-u(t - 2).

ylim([.1 1.1]);
The shift by 2 units
plot( (1=2)*tþ2,x); signal y(t - 2). The
mathematical expression
ylim([.1 1.1]); for
y1(t) = y(t - 2) is
Legend('y_1(t)') y1(t) = u(t + 1) - u(t + 3).
Fig. 3.5: Time-Invariant and Time-
Variant Systems

plot(t+2,x); The input signal x(t) is


ylim([.1 1.1]); shifted by t0 = 2 units to the
legend('x(t-2)') right, i.e., we plot the signal
x(t - 2).

t= -5:.1:10; The shifted input signal


x2= heaviside(t) - x2(t) = x(t - 2) is actually
heaviside(t4); given by x2(t) = u(t) - u(t -
plot(t,x2); 4). The (shifted) input signal
ylim([-.1 1.1]); is defined and plotted for
confirmation.

plot( (1=2)*t,x2); The system response y2(t)


ylim([-.1 1.1]); = x2(2t) is plotted. The
legend('y_2(t)') mathematical expression
for y2(t) is y2(t) = u(t) - u(t
- 2).

Fig. 3.6: Time-Invariant and Time-


Variant Systems
Signals and Systems (3150912)

Consider a system described by the i/o relationship y(t) = 1 - 2x(t - 1). Determine if
this is a time-invariant system by using the input signal x(t) = cos (t)[u(t) - u(t - 10)].

Code Results Comments

t = -5:.01:20;
p = heaviside(t1) - The system response y(t)
heaviside(t11); to the input x(t) is defined
y = 1-2*cos(t1).*p; and plotted.
plot(t,y)
legend('y(t)')

Alternative way ofplotting


the signal y(t) in terms of
p = heaviside(t) - x(t).
heaviside(t - 10);
x = cos(t).*p;
plot(t+1,1-2*x)
legend('y(t)')

The shifted by 4 units to


plot(t+4,y) the right output signal y(t
legend('y(t-4)') - 4).

Fig. 3.7: Time-Invariant and Time-


Variant Systems

p = heaviside(t-4) Graph of the shifted


heaviside(t-14); input signal x(t - 4).
x = cos(t-4).*p;
plot(t,x) First way to plot the
system response y2(t).
p = heaviside(t-4) - The response
heaviside(t - 14); y2(t) = S{x(t - 4)} to the
x = cos(t-4).*p; input
plot(t+1,1-2*x) signal x2(t) = x(t - 4) is
plotted in terms of x2(t).

Second way to plot the


t = -5:.01:20; system response y2(t).The
p = heaviside(t-5) - response
heaviside(t-15); y2(t) = S{x(t - 4)} of the
y2 = 12*cos(t-5).*p; system to
plot(t,y2); the shifted signal x2(t) is
legend('S[x(t4)]') Fig. 3.8: Time-Invariant and Time- computed as y2(t) = 1 -
Variant Systems 2cos(t-5)[u(t5) - u(t15)].

Inference:
Signals and Systems (3150912)

Simulation results

Causal and Non-causal Systems

Static (Memoryless) and Dynamic (with Memory) Systems

Linear and Nonlinear Systems

Conclusion:

Quiz:
1. Define linear and non linear system.

2 Write condition of linearity of system.


Signals and Systems (3150912)

3 For linear system when output become zero?

4 y(t)=etx(t) check linearity.

Rubrics 1 2 3 4 5 Total
Understanding of Compatibility of Regularity of Conclusion Participation (10)
MATLAB (2 Marks) MATLAB Submission and (2 Marks)
Coding (2 Marks) Applications
(2 Marks) (2 Marks)

Marks
Signals and Systems (3150912)

Experiment No: 5
CONVOLUTION OF CONTINUOUS-TIME SIGNALS

Date:

Competency and Practical Skills: Basic Knowledge of the Convolution of Signals

Relevant CO: CO-3:Analyze the response of the system for the efficient usage of the systems

Objectives: To perform convolution of continuous-time signals.


Equipment/Instruments: PC with Windows (95/98/XP/NT/2000). MATLAB Software

Theory:

Step1: For t < 0, the two signals do not overlap (zero overlap stage). Thus, the
response of the system is y(t) = 0

y(t) = 0

Fig. 4.1: Convolution of continuous


time signals
Step2: For 0 < t < 1, the two signals start to overlap (entry stage—partial overlap).
The limits of the integral are the limits that specify the shadowed area.

syms t r
f = 1-t+r; y = t1-2/*t^2
y = int(f,r,0,t)

Fig. 4.2: Convolution of continuous


time signals
Step3: For 1 < t < 2, the two signals overlap completely (complete overlap stage). The
only difference to the previous calculation is the integral limits.
Signals and Systems (3150912)

y = int(f,r,t-1,t) y =1-t+1/2*t^2-
simplify(y) 1/2*(t-1)^2
ans = 1/2

Fig. 4.3: Convolution of continuous


time signals
Step4: For 2 < t < 3, the two signals overlap partially (exit stage).

y = int(f,r,t1,2) y = 5-t-t*(3-t)-
1/2*(t-1)^2

Fig. 4.4: Convolution of continuous


time signals
Step5: For t > 3, there is no overlap; thus, the output is y(t) = 0, t > 3.

y(t) = 0

Fig. 4.5: Convolution of continuous-


time signals
Step6: Combining all the derived results
t1 = 0:.1:1;
t2 = 1:.1:2;
t3 = 2:.1:3;
y1 = t1(t1.^2)=2;
y2 = 0.5*ones(size(t2));
y3 = 0.5*( (3t3).^2);
plot(t1,y1,t2,y2,„.‟,t3,y3,„:‟)
ylim([0 0.6])
title(„Output signal y(t)‟);
Fig. 4.6: Convolution of continuous time
signals
Signals and Systems (3150912)

By using conv command

Step:1 Defining of signals


step = 0.01; The time step has to be quite small in order to approximate
accurately the continuous-time signals.
t = 0:step:2;
x = ones(size(t)); The input signal x(t) = 1, 0 ≤ t ≤ 2 is defined.

t1 = 0:step:1; The time intervals for the two parts of h(t) are defined
t2 = 1+step:step:2;

h1 = 1-t1; The impulse response h(t) is defined in the wider time interval,
h2 =zeros(size(t2)); namely, in the time interval where the input x(t) is defined.
h = [h1 h2];

Step:2 Convolution of signals using conv command


y = conv(x,h)*step; The response y(t) of the system is computed by convoluting
the input signal x(t) with the impulse response signal h(t)
and multiplying the result with the time step .

Step:3 Plotting results


ty = 0:step:4; The time interval in
which the output
signal y will be
plotted is 0 ≤ t ≤ 4,
plot(ty,y);
namely, it is double
from the time interval
where the vectors x
Fig. 4.7: Convolution of continuous
and h are defined.
time signals
The response of the
system y(t) computed
from the convolution
between the input
x(t) and the impulse
response h(t) is
plotted.
Signals and Systems (3150912)

Step:1 Defining of signals


t1 = [0:0.01:1.5]; The first rule is applied; that is, the input and impulse
t2 = [1.5+0.01:0.01:4]
response signals are defined over the same time interval (0
t3 = [4.01:0.01:10];
x1 = 0.6*ones(size(t1)); t 10), while the partial time intervals are constructed
x2 = 0.3*ones(size(t2));
in a way that they do not overlap (second rule).
x3 = zeros(size(t3));
x =[x1 x2 x3];
h = exp([t1 t2 t3]);

Step:2 Convolution of signals using conv command


y = conv(x,h)*0.01; The output of the system is computed by multiplying the
result of the convolution with the time step (third rule).
Step:3 Plotting results
plot(1:0.01:19, y) The output is plotted
title(„Output signal
in the double time
y(t)‟)
interval(fourth rule).
Notice that the output
signal is shifted by
one unit to the left
Fig. 4.8: Convolution of continuous
since the input signal
time signals
was shifted one unit
to the right

Step:1 Defining of signals


t1 = [1:0.01:0.5]; The output y(t) is plotted over the time interval 2 ≤ t ≤
x1 = .6*ones(size(t1));
20 as the input and impulse response signals are defined
t2 = [.5+0.01:0.01:3];
x2 = .3*ones(size(t2)); in the time interval
t3 = [3.01:0.01:10];
1 ≤t ≤ 10. Thus, when the input or the impulse response
x3 = zeros(size(t3));
x =[x1 x2 x3]; signals are nonzero for t < 0 the time interval where the
t1 = -1:.01:-.01;
output signal is plotted must be doubled for positive and
t2 = 0:.01:10;
h1 = zeros(size(t1)); negative values of t.
h2 = exp(t2);
h ¼=[h1 h2];
Step:2 Convolution of signals using conv command
y = conv(x,h)*0.01; The output of the system is computed by multiplying the
result of the convolution with the time step (third rule).
Signals and Systems (3150912)

Step:3 Plotting results


plot(1:0.01:19, y) The output is plotted in
title(„Output signal
the double time
y(t)‟)
interval(fourth rule).
Notice that the output
signal is shifted by one
unit to the left since the
Fig. 4.9: Convolution of continuous
input signal was shifted
time signals
one unit to the right

Step:1 Defining of signals


t1 = [1:0.01:0.5]; The output y(t) is plotted over the time interval 2 ≤ t ≤ 20 as
x1 =
the input and impulse response signals are defined in the time
.6*ones(size(t1));
t2 = [.5+0.01:0.01:3]; interval 1 to 10.
x2 =
Thus, when the input or the impulse response signals are
.3*ones(size(t2));
t3 = [3.01:0.01:10]; nonzero for t < 0 the time interval where the output signal is
x3 = zeros(size(t3));
plotted must be doubled for positive and negative values of t.
x =[x1 x2 x3];
t1 = -1:.01:-.01;
t2 = 0:.01:10;
h1 = zeros(size(t1));
h2 = exp(t2);
h ¼=[h1 h2];
Step:2 Convolution of signals using conv command
y = conv(x,h)*0.01; The output of the system is computed by multiplying the
result of the convolution with the time step (third rule).
Step:3 Plotting results
plot(1:0.01:19, y) The output is plotted
title(„Output signal
in the double time
y(t)‟)
interval(fourth rule).
Notice that the output
signal is shifted by
one unit to the left
Fig. 4.10: Convolution of continuous
since the input signal
time signals
was shifted one unit to
the right
47

Simulation results

Conclusion:

Quiz:

1. Write Different Operation involved in Convolution.

2 Write a MATLAB Command for Convolution and De-convolution of system.

3 Write Properties of Convolution.


48

Rubrics 1 2 3 4 5 Total
Understanding of Compatibility of Regularity of Conclusion Participation (10)
MATLAB (2 Marks) MATLAB Submission and (2 Marks)
Coding (2 Marks) Applications
(2 Marks) (2 Marks)

Marks
49

Experiment No: 06
LAPLACE TRANSFORM AND INVERSE LAPLACE TRANSFORM
Date:

Competency and Practical Skills: Basic knowledge of Laplace and Inverse LaPlace transform
of different signals.

Relevant CO: CO-2 Derive a mathematical model of the systems and signals for the applications.

Objectives: To perform Laplace transform and inverse LaPlace transform using MATLAB.
Equipment/Instruments: PC with Windows (95/98/XP/NT/2000). MATLAB Software

Theory: Laplace transformation is used to solve differential equations. In Laplace transformation,


the differential equation in the time domain is first converted or transformed into an algebraic
equation in the frequency domain. Next, this algebraic equation is solved and the result is
transformed into the time domain. This will be our solution to the differential equation. In simpler
words, Laplace transformation is a quick method to solve differential equations.

Example 1: Find the Laplace Transform of cos(at)


syms a t s

% define function f(t)


f=cos(a*t);

% laplace command to transform into


% Laplace domain function F(s)
F=laplace(f,t,s);

% Display the output value


disp('Laplace Transform of cos(at):')
disp(F);

Example 2: Find the Laplace Transform of a particular expression i.e. 1+2e^{(-t)}+3e^{(-2t)}.


% specify the variable a, t and s
% as symbolic ones
syms a t s e

% define function f(t)


f=1+2*exp(-t)+3*exp(-2*t);

% laplace command to transform into


% Laplace domain function F(s)
F=laplace(f,t,s);

% Display the output value


disp('Laplace Transform of 1+2e^{(-t)}+3e^{(-2t)}:')
disp(F);
50

Example:3
% MATLAB code to Solve Initial Value Second Order
% Differential Equation Problem using Laplace Transform:
% To clear all variables from the current workspace
clear all
clc
disp("Solving Initial Value 2nd Order Differential Equation
Problem using Laplace Transform in MATLAB | GeeksforGeeks")

% To Declare them as Variables


syms t s y(t) Y
dy(t)=diff(y(t));
d2y(t)=diff(y(t),2);
F=input('Input the coefficients [a,b,c]: ');

% Coefficients of the 2nd Order Differential Equation


a=F(1);b=F(2);c=F(3);

% R.H.S of the 2nd Order Differential Equation


nh=input('Enter the non-homogeneous part f(x) :');

% 2nd Order Differential Equation Formed


equation=(a*d2y(t)+b*dy(t)+c*y(t)-nh);
LTY=laplace(equation,t,s);

% Initial Value Conditions


y0=IC(1);dy0=IC(2);
IC=input('Enter the initial conditions in the form [y0,Dy(0)]:');
disp("After applying Laplace Transform on Both Sides: ")

% Y = L(y)
LTY=subs(LTY,laplace(y(t),t,s),Y)

% Substitute the Initial Value Condition-1 (y(0))


LTY=subs(LTY,y(0),y0);

% Substitute the Initial Value Condition-2 (y'(0))


LTY=subs(LTY,subs(diff(y(t),t),0),dy0);

% Collect the 'Y' Terms (L(y) terms)


eq=collect(LTY,Y);
disp("After Simplification, L(y) is: ")

% Simplify 'Y'
Y=simplify(solve(eq,Y))
51

% Find Inverse Laplace of 'Y' (ILap(Y)=ILap(L(y))=y))


yt=simplify(ilaplace(Y,s,t));
disp('The solution of the differential equation y(t)=')
disp(yt);

% Displaying the Plot of y(t) Found


ezplot(yt,[y0, y0+2]);

Example:4
% MATLAB code to Solve Initial Value Second Order
% Differential Equation Problem using Laplace Transform:
% To clear all variables from the current workspace
clear all
clc
disp("Solving Initial Value 2nd Order Differential Equation
Problem using Laplace Transform in MATLAB | GeeksforGeeks")

% To Declare them as Variables


syms t s y(t) Y
dy(t)=diff(y(t));
d2y(t)=diff(y(t),2);
F=input('Input the coefficients [a,b,c]: ');

% Coefficients of the 2nd Order Differential Equation


a=F(1);b=F(2);c=F(3);

% R.H.S of the 2nd Order Differential Equation


nh=input('Enter the non-homogeneous part f(x) :');

% 2nd Order Differential Equation Formed


equation=(a*d2y(t)+b*dy(t)+c*y(t)-nh);
LTY=laplace(equation,t,s);

% Initial Value Conditions


y0=IC(1);dy0=IC(2);
IC=input('Enter the initial conditions in the form [y0,Dy(0)]:');
disp("After applying Laplace Transform on Both Sides: ")

% Y = L(y)
LTY=subs(LTY,laplace(y(t),t,s),Y)

% Substitute the Initial Value Condition-1 (y(0))


LTY=subs(LTY,y(0),y0);

% Substitute the Initial Value Condition-2 (y'(0))


LTY=subs(LTY,subs(diff(y(t),t),0),dy0);
52

% Collect the 'Y' Terms (L(y) terms)


eq=collect(LTY,Y);
disp("After Simplification, L(y) is: ")

% Simplify 'Y'
Y=simplify(solve(eq,Y))

% Find Inverse Laplace of 'Y' (ILap(Y)=ILap(L(y))=y))


yt=simplify(ilaplace(Y,s,t));
disp('The solution of the differential equation y(t)=')
disp(yt);

% Displaying the Plot of y(t) Found


ezplot(yt,[y0, y0+2]);

Example 5: Find the Inverse Laplace Transform of 1/(s-a)

% specify the variable a, t and


% s as symbolic ones
syms a t s

% define function F(s)


F = 1/(s-a);

% ilaplace command to transform into


% time domain function f(t)
% Inverse Laplace Function
f1=ilaplace(F,s,t);

% Display the output value


disp(f1);
% Output can be verified by transforming
% function f1 into Laplace Domain F(s)
f=laplace(f1,t,s); % Laplace Function
disp(f);
Conclusion:

Rubrics 1 2 3 4 5 Total
Understanding of Compatibility of Regularity of Conclusion Participation (10)
MATLAB (2 Marks) MATLAB Submission and (2 Marks)
Coding (2 Marks) Applications
(2 Marks) (2 Marks)

Marks
53

Experiment No: 7
THE FOURIER SERIES OF GIVEN SIGNALS

Date:

Competency and Practical Skills: Basic knowledge of the Fourier Series of Signals

Relevant CO: CO-2

Objectives: To Draw The Fourier Series Of Given Signals


Equipment/Instruments: PC with Windows (95/98/XP/NT/2000). MATLAB Software

Theory:
In mathematics, a Fourier series decomposes any periodic function or periodic signal
into the sum of a (possibly infinite) set of simple oscillating functions, namely sines
and cosines (or complex exponentials). The study of the Fourier series is a branch of
Fourier analysis. The Fourier series was introduced by Joseph Fourier (1768-1830) for
the purpose of solving the heat equation in a metal plate.
Fourier series are used in the analysis of periodic functions. Many of the phenomena
studied in engineering and science are periodic in nature eg. the current and voltage in
an alternating current circuit. These periodic functions can be analyzed into their
constituent components (fundamentals and harmonics) by a process called Fourier
analysis.

% MATLAB code for Implementation of


% Fourier Series up to 'n' Harmonics in MATLAB:
clear all
clc
disp("Implementation of Fourier Series
up to 'n' Harmonics in MATLAB | GeeksforGeeks")
syms x

f=input("Enter the function of x, whose fourier series is to be found:");


I=input("Enter the limits of Integration [a , b] :");
k=input("Enter the number of Harmonics:");

% Lower limit of Integration


a=I(1);

% Upper limit of Integration


b=I(2);
l=(b-a)/2;
a0=(1/l)*(int(f,a,b));
Fx=a0/2;
54

% Calculating the nth Harmonic


for n=1:k
%To creates a new figure window
% using default property values
figure;
an(n)=(1/l)*(int(f*cos(n*pi*x/l),a,b));
bn(n)=(1/l)*(int(f*sin(n*pi*x/l),a,b));
Fx=Fx+((an(n))*cos(n*pi*x/l))+((bn(n))*sin(n*pi*x/l));

% To evaluate Each element of


% Fx to at least 4-Significant digits
Fx=vpa(Fx,4);

% To plot the curve Fx (Fourier series upto


% nth Harmonic) in the given interval [a,b]
ezplot(Fx,[a,b]);

% To add a second line plot (Given Function/f) without deleting


% the existing line plot (Fourier series upto nth Harmonic/Fx)
hold on;
ezplot(f,[a,b]);

% To plot the curve f (Given Function)


% in the given interval [a,b]
title(["The Fourier series upto ", num2str(n)," Harmonics is:"]);

% To create a legend with descriptive labels


% for both of the plotted lines (f & Fx)
legend("Fourier series","Given Function");

% To set the hold state to off


hold off;
end
disp(strcat('The Fourier series upto ', num2str(n),' Harmonics is:',char(Fx)))

Conclusion:
55

Rubrics 1 2 3 4 5 Total
Understanding of Compatibility of Regularity of Conclusion Participation (10)
MATLAB (2 Marks) MATLAB Submission and (2 Marks)
Coding (2 Marks) Applications
(2 Marks) (2 Marks)

Marks
56

Experiment No: 8
FOURIER TRANSFORM AND INVERSE FOURIER TRANSFORM OF A
GIVEN SIGNAL / SEQUENCE

Date:

Competency and Practical Skills: Basic

Relevant CO: CO-2: CO-2 Derive a mathematical model of the systems and signals for the
applications.

Objectives: To perform Fourier transform and inverse Fourier transform of a given


signal/sequence

Equipment/Instruments: PC with Windows (95/98/XP/NT/2000). MATLAB Software

Theory:
Fourier Transform is a mathematical model which helps to transform the signals between two
different domains, such as transforming a signal from the frequency domain to the time domain or
vice versa. Fourier transform has many applications in Engineering and Physics, such as signal
processing, RADAR, and so on. In this article, we are going to discuss the formula of the Fourier
transform, properties, tables, Fourier cosine transform, and Fourier sine transform with complete
explanations.
What is Fourier Transform?
The generalization of the complex Fourier series is known as the Fourier transform. The term
“Fourier transform” can be used in the mathematical function, and it is also used in the
representation of the frequency domain. The Fourier transform helps to extend the Fourier series to
the non-periodic functions, which helps us to view any functions in terms of the sum of simple
sinusoids.
Fourier transform expresses a signal (or function) x(t) in the (cyclic) frequency domain; that is,
the signal is described by a function X(Ω). The Fourier transform is denoted by the symbol F{.};
that is, one can write

In other words, the Fourier transform of a signal x(t) is a signal X(Ω). An alternative way of

it is clear that X(Ω) is a complex function of V. In case the Fourier transform of x(t) has to be
expressed in the frequency domain f, then substituting Ω by 2pf
57

There is the possibility to compute directly the Fourier transform X(Ω) of a signal x(t) by using
the command fourier. Correspondingly, the inverse Fourier transform is computed by using the
command ifourier. Before executing these two commands, time t and frequency V must be
declared as symbolic variables. Recall that a symbolic variable is defined by using the command
syms.

Program:
Example:1
clc; clear all; close all; fs=1000;
N=1024; % length of fft sequence t=[0:N-1]*(1/fs);
% input signal x=0.8*cos(2*pi*100*t); subplot(3,1,1);
plot(t,x);
axis([0 0.05 -1 1]);
grid; xlabel('t');
ylabel('amplitude'); title('input signal');
% magnitude spectrum x1=fft(x);
k=0:N-1;
Xmag=abs(x1); subplot(3,1,2);
plot(k,Xmag); grid;
xlabel('t'); ylabel('amplitude'); title('magnitude of fft signal')
%phase spectrum Xphase=angle(x1)*(180/pi); subplot(3,1,3); plot(k,Xphase);
grid; xlabel('t');
ylabel('angle in degrees'); title('phase of fft signal');

Conclusion:

Rubrics 1 2 3 4 5 Total
Understanding of Compatibility of Regularity of Conclusion Participation (10)
MATLAB (2 Marks) MATLAB Submission and (2 Marks)
Coding (2 Marks) Applications
(2 Marks) (2 Marks)

Marks
58

Experiment No: 9
Z TRANSFORM AND INVERSE Z TRANSFORM

Date:

Competency and Practical Skills Transform and Inverse Z-Transform

Relevant CO: CO-2: CO-2 Derive a mathematical model of the systems and signals for the
applications.

Objectives: To perform z transform and inverse z transform

Equipment/Instruments: PC with windows (95/98/XP/NT/2000). MATLAB Software

Theory:
As Laplace transform is a more general transform compared to the Fourier transform for
continuous-time signals, z-transform is a more general transform than discrete-time Fourier
transform when dealing with discrete-time signals. A discrete-time signal is defined in the
discrete-time domain n; that is, it is given by a function f [n], n 2 Z. z-transform is denoted by the
symbol Z{_} and expresses a signal in the z-domain, i.e., the signal is given
by a function F(z). The mathematical expression is
F(z) = Z{ f [n]}
In other words, the z-transform of a function f [n] is a function F(z). The mathematical
expression of the two-sided (or bilateral) z-transform is

where z is a complex variable. Setting the lower limit of the sum from minus infinity to zero
yields the one-sided (or unilateral) z-transform whose mathematical expression is

In order to return from the z-domain back to the discrete-time domain, the inverse
z-transform is applied. The inverse z-transform is denoted by the symbol Z_1{_}; that is,
one can write

Commands ztrans and iztrans


In MATLAB, the z-transform F(z) of a sequence f [n] is computed easily by using the command
ztrans. Moreover, the inverse z-transform of a function F(z) is computed by using the command
iztrans. Before using these two commands, the declaration of the complex variable z and of the
discrete time n as symbolic variables is necessary. Recall that in order to define a symbolic variable,
the command syms is used. The commands ztrans and iztrans are used exactly in the same way as
the commands laplace and ilaplace are used to compute the Laplace and inverse Laplace transforms
of a function. Finally, we note that the command ztrans computes the unilateral z-transform.
59

Example:-1:
clc ;
clear all ;
close all ;
syms n
sig = cos (n);
disp('z transform')
ztrans(sig)

Solution-1

Example:-2
clc ;
clear all ;
close all ;
syms var1 var2
sig = exp(var1+var2);
disp('z transform')
ztrans(sig)
Solution-2

Example:-3

clc ;
clear all ;
close all ;
syms var1 var2 x
sig = exp (var 1 + var 2);
disp('z transform')
ztrans(sig, x)

Solution-3

Example:-4
clc ;
60

clear all ;
close all ;
syms var1 var2 x
sig = exp(var1 + var2 ) ;
disp( 'z transform')
ztrans (sig, var 1, x)

Solution-4

Conclusion:

Quiz:

Rubrics 1 2 3 4 5 Total
Understanding of Compatibility of Regularity of Conclusion Participation (10)
MATLAB (2 Marks) MATLAB Submission and (2 Marks)
Coding (2 Marks) Applications
(2 Marks) (2 Marks)

Marks
61

Experiment No: 10
UNIT SAMPLE, UNIT STEP, AND SINUSOIDAL RESPONSE OF THE
GIVEN LTI SYSTEM

Date:

Competency and Practical Skills: To find responses of Different Systems.

Relevant CO: CO-4 Design of the system from the available input signals and expected output signals
of the industrial model.

Objectives: To compute the Unit sample, unit step and sinusoidal response of the given LTI system and
verify its stability using VLAB and MATLAB.
Equipment/Instruments: PC with windows (95/98/XP/NT/2000). MATLAB Software

Theory:
A discrete time system performs an operation on an input signal based on predefined criteria to
produce a modified output signal. The input signal x(n)is the system excitation, and y(n) is the
system response. The transform\ operation is shown as,

If the input to the system is unit impulse i.e. x(n) = δ(n) then the output of the system is known as
impulse response denoted by h(n) where(n) = T[δ(n)]we know that any arbitrary sequence x(n) can
be represented as a weighted sum of discrete impulses. Now the system response is given by,

For linear system (1) reduces to


given difference equation y(n)-y(n-1)+.9y(n-2)=x(n);

Program:
%given difference equation y(n)-y(n-1)+.9y(n-2)=x(n); b=[1];
a=[1,-1,.9]; n =0:3:100;
%generating impulse signal x1=(n==0);
%impulse response
h1=filter(b,a,x1); subplot(3,1,1);
stem(n,h1);
xlabel('n');
ylabel('h(n)'); title('impulse response');
%generating step signal x2=(n>0);
% step response s=filter(b,a,x2); subplot(3,1,2);
stem(n,s);
xlabel('n');
ylabel('s(n)') title('step response');
62

%generating sinusoidal signal t=0:0.1:2*pi;


x3=sin(t);
% sinusoidal response
h2=filter(b,a,x3); subplot(3,1,3); stem(h2);
xlabel('n');
ylabel('h(n)'); title('sin response');
% verifing stability figure;
zplane(b,a);
Conclusion:

Quiz:
1. Write the Concept of unit step impulse and sinusoidal signal.

2 Write a Condition for Stability of LTI System.

Rubrics 1 2 3 4 5 Total
Understanding of Compatibility of Regularity of Conclusion Participation (10)
MATLAB (2 Marks) MATLAB Submission and (2 Marks)
Coding (2 Marks) Applications
(2 Marks) (2 Marks)

Marks
Signals and Systems
3150912
Lab Manual prepared by
Prof. Darshan U. Thakar
Assistant Professor,
Electrical Engineering
GEC-Modasa

Branch Coordinator
Dr. J.R.Iyer
Professor, Electrical Engineering
L.D. College of Engineering
Ahmedabad
Committee Chairman
Dr N M Bhatt
Professor ,Mechanical Engineering
L.E.College, Morbi

You might also like