You are on page 1of 26

Lab manual Of Signal & system

Name: M Amjad Aslam

Roll No: 4

Submitted to : sir sohaib Ahmad


Semester: 4th

Technology: Bs Electrical (4th)

Institute of southern Punjab

pg. 1
Objective: Introduction to MATLAB
 Outline:
 What is MATLAB?
 MATLAB Features.
 Getting Started with MATLAB.
 Practical Hints.
 From Analog to Digital.
 MATLAB commands.
 MATLAB script file.
 MATLAB function file.
 Control Flow Functions

pg. 2
What is MATLAB?
MATLAB is a power full language for technical computing. The
name MATLAB stand for Matrix Laboratory, because its basic
data element is a matrix (array).MATLAB can be use for match
computations, modeling and simulations, data analysis and
processing, visualization and graphics and algorithm
development.
MATLAB is a windily use universities and colleges in
introductory and advance courses in mathematics, science, and
especially in engineering .In industry software is used in
research, development and design.
Some important commands of MATLAB
1. Clc: The clc command clear the command windows. After
the working in command window for a while, the display
may become very long. Once clc command is executed
clear window is display.
2. Clear: Remove all variable from memory.
3. Who: The display a list of variable currently in memory.
4. Whose: The display a list of variable currently in memory
& their size together with information about their bytes &
class.

pg. 3
5. Clear all: The clear all variables in your workspace trust
me you will be using this one.
6. Zeros: Creates a vector or matrix of zeros.
7. Rand: The create random vector or matrix. So convenient
when you are just goofing around or testing basic things.
8. Disp: The disp command is use to display the elements of
variable without displaying name of variable, and to text.
9. Cart2pol: Transforms two- dimensional Cartesian
coordinates stored in cross ponding element of array x & y
into polar coordinates.
10. Stem: A two dimensional stem plot displays data as line
extending form a baseline along. A circle or other a
marker whose y-position represents the data value
terminates each stem.
11. Num2str: The num2str function converts number to
their string representation. This function is usefull for
labeling and titeling plot with number value.
12. Label command: Each exes graphics object can have
one label for x, y, & z-axis. The label appears beneath its
represented axis in two dimensional plots and to side or
beneath axis in a three-dimensional plot.
13. Title command: Each exes graphics objects can have
one title . The title is located at top and in center of axis.
14. Input command: The input command prompt user for
an input can be very useful when using if conditions.

pg. 4
Operators and special characters
Item Description
+ Plus; addition operator.
_ Minus ; subtraction operator.
* Scalar and matrix multiplication operation.
= Assignment operator.
… Ellipsis, line-continuous operator.
% designates comment & specifies formatting.
Command for managing a session.
Item Description
Linespace Creat regularly spaced vector.

help Search for a help topic.

quit Stop MATLAB.

eye Cerate an identy matrix.

inv Invers of matrix.

pg. 5
Complex number & function.
Complex number is kind of tow dimensional vectors whose
components are so-called real part imaginary part. The real
part usually corresponds to physical quantities while imaginary
part is a purely mathematical constructions. Complex number
are useful in physic as well in mathematic of real numbers,
because they open a new dimension that allows to arrive at
result in match faster and elegant way. Using complex numbers
allows sometimes to obtain analytical results that is impossible
to obtain in other way, such as exact value of definite integrals.
Basic definition. Complex numbers can be introduced in
component form.
x(t) ∈ C and x[n] ∈ C,

where the set of complex number is define as.



C = {z | z = x + jy, x, y ∈ R, j = −1.}

A complex number z can be represented in Cartesian form as


z = x + jy,

or in polar form as
z = r ejθ.

Theorem 1 Euler’s formula


ejθ = cos θ + j sin θ.

pg. 6
The using Eluer’s formula relation between x, y, r & θ is given by

x = r cos θ
p 2
y = r sin θ and r= x + y2,
θ = tan−1 x/y. x

pg. 7
Lab 01
Problem statement: Convert the following Cartesian number
to polar form.
 2+3j

Result:

pg. 8
Lab 02
Problem statement: Convert the following polar number to
Cartesian form.
 35ej45 .

Result:

pg. 9
Lab 03
Problem statement: Develop the MATLAM code for
multiplying and devision following complex signals.
Z1=3+4j; Z2=-2+5j

Result:

pg. 10
Hyperbolic function’s
The hyperbolic cosine function, written cos hθ, is defined for all
real value of θ by relation.

cos hθ=1/2(eθ+e-θ)
Similarly the hyperbolic sine function sinhθ is defined by ,

sinhθ=1/2(eθ+e-θ)

The name of these to hyperbolic function suggest that thay


have similar properties to trigonometric function & some of
these will be investigated.
Graphs of hyperbolic function
You could plot graphs of coshx & sinhx quit easily on a graphics
calculator & obtain graphs as show opposite.

pg. 11
The shape of graph of Y=coshx is that of a particular chain
supported at each end and hanging freely . It is often called a
catenary.

a) Superimpose graphs of y=coshx & y=sinhx on screen of a


graphics calculator.
b) Use a graphics calculate to sketch the function
tanhx with domain aaaaa
c) Try to predict what the graphs of Y=sechx, y=cosechx &
y=cothx.

pg. 12
Lab 04
Problem statement: Discrete time hyperbolic signal
generation with user defined value for x-axis.

pg. 13
Lab 05
Problem statement: continuous time hyperbolic
signal generation with user defined value for x-axis.

pg. 14
Sinusoidal function
Sine and cosine function are periodic function i.e. the
waveform repeat in certain interval called period T.
A sinusoidal function is made of a linear combination of
sine & cosine function. In general all sinusoidal function
can be written as a ‘phase-shifted’.

Lab 06
Problem statement: Discrete time sinusoidal signal
generation with user defined value for x-axis.

pg. 15
Output graph:

pg. 16
Lab 07
Problem statement: continuous time sinusoidal signal
generation with user defined value for x-axis.

pg. 17
Output graph:

pg. 18
Quiz
Problem statement: Draw the sinusoidal signal with user
defined value for x-axis enter value on X-axis should be 0.3sec,
Lable x-axis with your name Y-axis with your roll number, graph
title must be your semester.

pg. 19
Output graph:

pg. 20
Lab 08
Problem statement: Unit impulse signal generation with user
defined value of X-axis.

Output graph:

pg. 21
Lab 09
Problem statement: Discrete time unit delay step signal
generation with user delay rang of 10 value for x-axis.

Output graph:

pg. 22
Lab 10
Problem statement: Ramp signal generation with user
defined value of x-axis.

Output graph:

pg. 23
Lab 11
Problem statement: Continuous time unit step delay signal with
user defined value of x-axis .

pg. 24
Output graph:

Quiz
Program statement: Generate unit impulse signal with user
defined value of x-axis program x-label must be your roll no ,
y-label your name & title must be unit impulse.

pg. 25
Output graph:

pg. 26

You might also like