Download as pdf or txt
Download as pdf or txt
You are on page 1of 76

REC 353 SIGNALS & SYSTEMS LAB

LAB MANUAL
ACADEMIC SESSION 2018-19

Department of Electronics and Communication Engineering


G L Bajaj Institute of Technology and Management
Greater Noida – 201306

Lab Incharge:-Dr. Amrita Rai HOD.(ECE)


TABLE OF CONTENTS

 Syllabus

 Practical Outcome

 Mapping of Program Outcomes with Practical Outcome

 Session Plan

 Laboratory policies & Report format

 Evaluation sheet

 Each experiment should be with post lab questions with answer key

Department of Electronics and Communication Engineering


List of Experiments
Sr. No. Name of Experiment PAGE
NO.
1. I. To define and use variables and functions in MATLAB.
II. To define and use vectors and Matrices in MATLAB.
III. To study various MATLAB arithmetic operators and mathematical
functions.
IV. To create and use m-files.
2. 1. To study various MATLAB commands for creating two and three-
dimensional plots.
2. Write a MATLAB program to plot the following Continuous time
and discrete time signals.
i) Step Function, ii)Impulse Function, iii)Exponential Function
iv) Ramp Function v) Sine Function
3. Write a MATLAB program to perform amplitude –scaling, time-scaling and time
shifting on a given signal by defining functions.

4. 1. Write a MATLAB program to obtain linear convolution of the given CT


and DT sequence using the function conv.
2. Compare and verify the result obtained with the expected theoretical
results.
5. 1. Write a MATLAB program to compute autocorrelation of a sequence
x(n) and verify the property.
2. Write a MATLAB program to compute cross-correlation of a sequence
x(n) and y(n) and verify the property.
6. 1. To calculate Fourier Series coefficients associated with Square Wave and
Triangular wave.
2. To sum the first 10 terms and plot the Fourier series as a function of time.
3. To sum the first 50 terms and plot the Fourier Series as a function of time
7. 1. Calculate Fourier Transform of a given signal and plot the magnitude and
the phase spectrum.
2. Calculate the Z-transform of a given signal and plot the poles and zeros of
the Z-transform
8. 1. Write a MATLAB program to find the impulse response and step
response of a system from its difference equation.
2. Compute and plot the sequence of a given system to a given input.
9. 1. For a given system function write a MATLAB program to plot the poles,
zero configuration and Bode plot.
2. Analyze the stability of the given system from the Bode plot
10. 1. Write a MATLAB program to plot the frequency response of the first
order system.
2. Also write MATLAB program to calculate the rise time and bandwidth of
same system.

Department of Electronics and Communication Engineering


11. 1. Build a system that amplifies a sine wave by a factor of two.
2. Test the linearity of this system using SIMULINK
Experiments beyond recommendation of AKTU, Lucknow

12 Write a MATLAB program for understanding Sampling theorem.

13 Write a MATLAB program for Test the Stability of this system

EVALUATION SCHEME
Periods Evaluation Scheme
Sr.
No Subject Name of the Subject Subject Credit
Code Sessional Assessment ESE Total
L T P CT T A AT Total

1 REC-353 SIGNALS AND 0 0 2 20 20 10 50 50 100 1


SYSTEMS LAB

Department of Electronics and Communication Engineering


PRACTICAL OUTCOMES
REC353.01 Generate Basic CT and DT signals and their 2-D and 3-D plots using MATLAB.(L3- Applying)

REC353.02 Calculate the various effects of transforms of signals Parameter.(L3-Applying)

REC353.03 Examine linear convolution, autocorrelation and cross-correlation, Fourier series expansion

of periodic functions. (L4-Analyze)

REC353.04 Analysis of system with respect to the impulse response and step response, pole-zero diagram &

Bode diagram. (L2-Understand)

Mapping of Program Outcomes with Practical Objectives

Sr. PrO/PO PO1 PO2 PO3 PO4 PO5 PO6 PO7 PO8 PO9 PO10 PO11 PO12 PSO1 PSO2
No.

1 REC353.01 3 2 - - 3 - - 1 1 1 - 1 - 1

2 REC353.02 3 2 - - 3 - - - 1 1 - 1 - 1

3. REC353.03 3 2 3 - 3 - - - 1 1 - 1 - 1

4. REC353.04 2 2 3 - 3 - - - 1 1 - 1 - 1

(Put 1 ,2,3 for mapping)

1: Slight (low) 2: Moderate (Medium) 3: Substantial(High)

If there is no correlation put “-”

Department of Electronics and Communication Engineering


SESSION PLAN
COURSE : B.Tech ( ECE)

TITLE : Signals and Systems Lab

CREDIT : 01

LOCATION : CAD Lab (Room. No. 402)

PREREQUISITES COURSES : Knowledge of Basic signals and systems.

PREREQUISITIES BY TOPIC : Definition of Signals and Systems, Engineering


Functions ,Time Domain Analysis, Noise, Periodic
Signals, Frequency Representation of Signals, Fourier
Series, Fourier Series Analysis, Fourier Transform,
Frequency Analysis of Systems, Frequency Response,
Bode Plots, Laplace Transform.

TEXT BOOK(S) AND/OR REQUIRED MATERIALS:

1. “Digital Signal Processing Using MATLAB” ,Vinay K. Ingle ,John G. Proakis, Cengage Learning.

2. AV Oppenheim, A.S. Willsky and S. Hamid Nawab, ‘Signals and Systems’ Pearson Education.

3. TK Rawat, “Signals and Systems”, Oxford University Press.

Reference Books:

1. A Anand kumar , “Signals and Systems”, PHI Learning Pvt. Ltd


2. A Guide to MATLAB: For Beginners and Experienced Users By Brian R. Hunt, Ronald L. Lipsman,
Jonathan M. Rosenberg, Kevin R. Coombes, John E. Osborn,

WEB RESOURCES:
1. Mathworks Website www.mathworks.com/
2. Virtual Lab Website http://www.vlab.co.in/
3. Virtual Lab Website http://iitg.vlab.co.in/?sub=59&brch=166

Department of Electronics and Communication Engineering


LABORATORY POLICIES AND REPORT FORMAT

Standard Operating Procedure (SOP)

The faculty will explain the theory of corresponding practical in brief.

1. Students will perform the experiment as per instructions given and lab manual.
2. Students will maintain a notebook for reading/results of the experiment and get its signed by
the lab instructor/faculty.
3. Lab report for each experiment shall be submitted for evaluation in the next week of
performing the experiment.
4. The performance of each experiment will be graded as per the policy.

General Instructions

Every lab requires preparation prior to performing the experiments. Students are required to perform
this preliminary work prior to coming to the lab. For this lab session your lab instructor will help
you get started.

1. Before starting of the laboratory the students are instructed with necessary safety and
precautionary measures that has to be adopted in any electronics laboratory.
2. Well-designed laboratory manual / instruction sheets are provided to students at the
beginning of the session for a particular lab.
3. It is extremely important for students to read equipment manual given to you before coming
to the laboratory. Failure to do so might result in your not being able to finish this lab
session within the allotted time.
4. Be sure that the measuring equipment is set up correctly and you are reading the correct
parameters.
5. If steps 4 through 7 are correct, then you probably have used a component with the wrong
value or one that doesn't work. It is also possible that the equipment does not work or the
protoboard you are using may have some unwanted paths between nodes.
6. Note the readings and result in reading notebook.

Signature Date
Department of Electronics and Communication Engineering
Safety Rules

Safety is always an important topic whenever laboratory work is being considered, and it is certainly
true in the case of Electronics and Communication Engineering labs. Safety is important.
1. Note the location of the Emergency Disconnect to shut off power in an emergency.
2. Students are allowed in the laboratory only when the lab instructor is present.
3. Open drinks and food are not allowed near the lab benches.
4. Report any broken equipment or defective parts to the lab instructor. Do not open, remove
the cover, or attempt to repair any equipment.
5. When the lab exercise is over, all PC must be turned off.
6. Do not plug in external devices without scanning them for computer viruses.
7. Ensure that the temperature in the room stays cool, since there are a lot of machines inside a
lab as these can overheat easily
8. Institution property must not be taken from the laboratory.

I have read and understood these rules and procedures. I agree to abide by these rules and procedures
at all times while using these facilities. I understand that failure to follow these rules
and procedures will result in my immediate dismissal from the laboratory and additional disciplinary
action may be taken.

Signature Date

Department of Electronics and Communication Engineering


INTERNAL EVALUATION SCHEME

Sr. No. Evaluation Criteria %


1 Attendance 20
2 TA Lab Performance and Weekly 20
observation note
Practical Files 20
3 CT (Internal Written Test and Practical 20
Practical Exam.) Performance
Viva-Voice 20

Department of Electronics and Communication Engineering


INTRODUCTION
MATLAB, which stands for Matrix Laboratory, is a very powerful program for performing
numerical and symbolic calculations, and is widely used in science and engineering, as well as in
mathematics.

What is MATLAB?
A high-performance language for technical computing.
Typical uses of MATLAB:
o Mathematical computations.
o Algorithmic development.
o Model prototyping (prior to complex model development).
o Data analysis and exploration of data (visualization).
o Scientific and engineering graphics for presentation.
o Complex analysis using MATLAB toolboxes (i.e., statistics,
o Neural networks, fuzzy logic, H-infinity control, economics, etc.)
The MATLAB Environment

Department of Electronics and Communication Engineering


EXPERMENTAL NO.-1
AIM: Introduction to MATLAB:

i) To define and use variables and functions in MATLAB.


ii) To define and use vectors and Matrices in MATLAB.
iii) To study various MATLAB arithmetic operators and mathematical functions.
iv) To create and use m-files.
Introduction:
The purpose of this lab is to familiarize you with basic MATLAB functionality. MAT-LAB is a
computational tool consisting essentially of a command interpreter/compiler for which there is a vast
set of libraries and graphical representation tools, in addition to a nice user interface. Because of its
simplicity and ease of use it is widely used in industrial and academic environments.
In this lab you will focus on several easy tasks that will make you feel comfortable with MAT-
LAB's development environment and programming language. A more comprehensive intro-
duction/tutorial can be obtained for free from Mathworks, the makers of MATLAB
http://www.mathworks.com/access/helpdesk/help/techdoc/matlab.shtml (in documentation choose
Getting Started ). After gaining some experience you'll rarely need any tutorials or books, since the
available help command and the ability of searching the electronic documentation is satisfactory for
most problems.

Basic of MATLAB:

Whenever you are unsure of the syntax of a command, or want to find how to do some-thing you can
rely on a few helpful commands that can quickly provided with the needed information. The most
basic command we will use is help. Typing:

>> help help;

at the MATLAB prompt we get:

HELP On-line help, display text at command line.

HELP, by itself, lists all primary help topics. Each primary topic corresponds to a directory name on
the MATLABPATH.

"HELP TOPIC" gives help on the specified topic. The topic can be a command name, a directory
name, or a MATLABPATH relative partial pathname (see HELP PARTIALPATH). If it is a
command name, HELP displays information on that command. If it is a directory name, HELP

Department of Electronics and Communication Engineering


displays the Table-Of-Contents for the specified directory. For example, "help general" and "help
matlab/general" both list the Table-Of-Contents for the directory toolbox/matlab/general.

HELP FUN displays the help for the function FUN.

T = HELP('topic') returns the help text in a '\n' separated string.

LOOKFOR XYZ looks for the string XYZ in the first comment line of the HELP text in all M-files
found on the MATLABPATH. For all files in which a match occurs, LOOKFOR displays the
matching lines.

MORE ON causes HELP to pause between screenfuls if the help text runs to several screens.

In the online help, keywords are capitalized to make them stand out. Always type commands in
lowercase since all command and function names are actually in lowercase. For tips on creating help
for m-files 'type help.m'.

See also LOOKFOR, WHAT, WHICH, DIR, MORE.

For example, to learn more about the function sum you should type help sum. This is the general
style of help. It not only gives a detailed description of the topic often including examples, but refers
to related topics as well. For example, when seeking help about the function sum you also learn that
there is a function prod that is somewhat related.

This style of help is displayed on the prompt. As you probably noticed the screen is cluttered with
text and we need to scroll up in order to read the full article. An arguably better way to get help is to
use the HTML version. The command doc works the same way as help with the difference that it
launches a window displaying the HTML version of the help file. This way is preferable as links to
related commands as well as graphics are included. Typing:

>> doc help;

gives us the HTML version. Typing help without arguments gives us a full list of topics and
toolboxes with short descriptions.

Variables:

Defining variables

As we have seen in previous sections we can type commands and execute them in the command
prompt >>. Now if we type:

Department of Electronics and Communication Engineering


>> x=5

X= 5

We define a variable x and assign the value 5. Notice that we don't need to define the type (such as
string or number) of the variable. MATLAB is able to infer the type (within reason).

Clearing variables:

The command:

>> clear X;

Clears the variable from the workspace. This is useful for example when we want to reclaim system
memory. We can also clear variables when we want to make sure that any old values are not going to
be used by accident.

Built-in variables:

MATLAB includes a number of special variables that are built in the system. For example, entering
pi gives us the value of pi

Other special variables include i and j , that, as you guessed, correspond to the imaginary unit. It is
possible to overwrite special variables. For example, typing pi = 5 assigns a new value, thus loosing
its previous, built-in value. The original values of the built-in variables can be returned by using the
clear statement as illustrated below

Department of Electronics and Communication Engineering


Scalars, Vectors and Matrices:

MATLAB's simplest mathematical objects are scalars, vectors and matrices. These are the quantities
you are going to manipulate more often, as vectors and matrices can be used to represent signals,
images, among other things. The command interpreter is highly optimized to perform operations
with vectorial quantities. This is in fact what the name MATrix to LABratory denotes. In this lab
session you will get a first contact with these objects, and will learn more in subsequent lab sessions.
There are two types of vectors. Row vectors and column vectors. By convention one typically uses
column vectors to represent signals. For displaying purposes we will use row vectors since they
occupy less lines when printed. The simplest way to create a column vector is by the bracket
concatenation operator. We separate the various values by using a semi-colon.

Typing:

If we want to create a row vector instead we can use spaces or commas as separators instead:
Department of Electronics and Communication Engineering
Operators:

One can see MATLAB as a glorified calculator. In this sense operators are the special characters that
provide MATLAB the calculator functionality. The most basic operators are:

Department of Electronics and Communication Engineering


Department of Electronics and Communication Engineering
The use of most operators is self explanatory but if you need more help in any of them you can use
the help system, e.g. help m times gives:

Elementary functions:

The elementary functions can be found by typing help elfun. The most basic functions follow.

Elementary math functions.

Trigonometric.

sin - Sine.

sinh - Hyperbolic sine.

asin - Inverse sine.

asinh - Inverse hyperbolic sine.

cos - Cosine.

cosh - Hyperbolic cosine.


Department of Electronics and Communication Engineering
acos - Inverse cosine.

acosh - Inverse hyperbolic cosine.

tan - Tangent.

tanh - Hyperbolic tangent.

atan - Inverse tangent.

atan2 - Four quadrant inverse tangent.

atanh - Inverse hyperbolic tangent.

sec - Secant.

sech - Hyperbolic secant.

asec - Inverse secant.

asech - Inverse hyperbolic secant.

csc - Cosecant.

csch - Hyperbolic cosecant.

acsc - Inverse cosecant.

acsch - Inverse hyperbolic cosecant.

cot - Cotangent.

coth - Hyperbolic cotangent.

acot - Inverse cotangent.

acoth - Inverse hyperbolic cotangent.

Exponential.

exp - Exponential.

log - Natural logarithm.

log10 - Common (base 10) logarithm.


Department of Electronics and Communication Engineering
log2 - Base 2 logarithm and dissect floating point number.

pow2 - Base 2 power and scale floating point number.

realpow - Power that will error out on complex result.

reallog - Natural logarithm of real number.

Realsqrt - Square root of number greater than or equal to zero.

sqrt - Square root.

nextpow2 - Next higher power of 2.

Complex.

abs - Absolute value.

angle - Phase angle.

complex - Construct complex data from real and imaginary parts.

conj - Complex conjugate.

imag - Complex imaginary part.

real - Complex real part.

unwrap - Unwrap phase angle.

isreal - True for real array.

cplxpair - Sort numbers into complex conjugate pairs.

Rounding and remainder.

fix - Round towards zero.

floor - Round towards minus infinity.

ceil - Round towards plus infinity.

round - Round towards nearest integer.

mod - Modulus (signed remainder after division).


Department of Electronics and Communication Engineering
rem - Remainder after division.

sign - Signum.

Remember to use the help command to get more information for any of those functions.

Flow control:

The for statement:

Repeating statements for an arbitrary number of times is one of the most important features

of most programming languages. It used to be the case that MATLAB was not able to repeat
statements efficiently but this is not true anymore. Starting with version 6.5 MATLAB includes a
JIT-compiler which is responsible for optimizing loops.

The for loop repeats a group of statements for a fixed, predetermined number of times. A matching
end denotes the end of the loop. For example:

Department of Electronics and Communication Engineering


The semicolon terminating the inner statement suppresses repeated printing, and the s after the loop
displays the final result. Nested loops are good to be indented for readability. The MATLAB editor
smart-indents nested loops and other constructs as we type. For example indentation makes the
following loop more readable.

The if statement:

The if statement executes a group of commands depending on the value of a logical expression. The
else and elseif constructs are optional and provide additional branching. For example

PROGRAMS:

RESULTS:

Department of Electronics and Communication Engineering


QUESTIONS & ANSWERS
Please carefully read the following question and implement it using Matlab.

Q-1 How to open, save the .m file?

Q-2 How to execute the editor file?

Q-3 What is the MATLAB command use to calculate e5 and log105

Q-4 Write the MATLAB command used to display more than one plot in same figure

Department of Electronics and Communication Engineering


EXPERIMENT NO.-2
AIM: Basic plotting of signals

1. To study various MATLAB commands for creating two and three-dimensional plots.
2. Write a MATLAB program to plot the following Continuous time and discrete time
signals.
i) Step Function
ii) Impulse Function
iii) Exponential Function
iv) Ramp Function
v) Sine Function
EQUIPMENT REQUIRED:

1. PC installed with MATLAB software (7.12.0(R2011a) version).


2. Printer.

PART 1

1. MATLAB desktop:

On starting MATLAB the MATLAB desktop appears, containing tools (graphical user interfaces
) for managing files , variables and applications associated with MATLAB. It contains :

(i) Command Window and Command History

Command Window : Use the Command Window to enter variables and to run functions and M-
file scripts. Press the up arrow key to recall a statement previously typed. Edit the statement as
needed and then press Enter to run it.

Command History : Statements entered in the Command Window are logged in the Command
History. From the Command History, previously run statements can be viewed, copied and
executed. M-file can be created from selected statements.

(ii) Current Directory Browser and Search Path : MATLAB file operations use the current
directory and the search path as reference points. Any file required to run must either be in the
current directory or on the search path.

(iii) Workspace Browser and Array Editor :The MATLAB workspace consists of the set of
variables (named arrays) built up during a MATLAB session and stored in memory. The
variables can be added to the workspace by using functions, running M-files, and loading saved

Department of Electronics and Communication Engineering


workspaces. To delete variables from the workspace, select the variables and select Edit >
Delete.

Array Editor : Double-click a variable in the Workspace browser, or use open var variable name,
to see it in the Array Editor. Use the Array Editor to view and edit a visual representation of
variables in the workspace.

(iv) Editor/Debugger : Editor/Debugger is used to create and debug M-files, which are
programs to run MATLAB functions. The Editor/Debugger provides a graphical

user interface for text editing, as well as for M-file debugging. To create or edit an M-file use
File > New or File > Open, or use the edit function.

The important commands/ functions are as below :

1. clc (Remove items from workspace, freeing up system memory) clears all input and output
from the Command Window display, giving "clean screen." After using clc, the scroll bar
cannot be used to see the history of functions, but still the up arrow can be used to recall
statements from the command history.

2. close (Remove specified figure): close deletes the current figure or the specified figure(s). It
optionally returns the status of the close operation.

3. xlabel, ylabel, zlabel (Label x-, y-, and z-axis) : Each axes graphics object can have one
label for the x-, y-, and z-axis. The label appears beneath its respective axis in a two-
dimensional plot and to the side or beneath the axis in a three-dimensional plot.
xlabel('string') labels the x-axis of the current axes.

ylabel(...) and zlabel(...) label the y-axis and z-axis, respectively, of the current axes.

4. title( Add title to current axes) : Each axes graphics object can have one title. The title is
located at the top and in the center of the axes.
title('string') outputs the string at the top and in the center of the current axes.

5. figure (create figure graphics object) : figure creates figure graphics objects. Figure objects
are the individual windows on the screen in which MATLAB displays graphical output.

6. subplot (Create axes in tiled positions): subplot divides the current figure into rectangular
panes that are numbered row wise. Each pane contains an axes object. Subsequent plots are
output to the current pane. For example,

subplot(2,1,1), plot(income)
Department of Electronics and Communication Engineering
subplot(2,1,2), plot(outgo) plots income on the top half of the window and outgo on the
bottom half.

7. stem (Plot discrete sequence data) : A two-dimensional stem plot displays data as lines
extending from a baseline along the x-axis. A circle (the default) or other marker whose y-
position represents the data value terminates each stem.
stem(Y) Plots the data sequence Y as stems that extend from equally spaced and
automatically generated values along the x-axis. When Y is a matrix, stem plots all elements
in a row against the same x value.

stem(X,Y) plots X versus the columns of Y. X and Y must be vectors or matrices of the
same size. Additionally, X can be a row or a column vector and Y a matrix with length(X)
rows.

8. bar(Plot bar graph (vertical and horizontal)) : A bar graph displays the values in a vector
or matrix as horizontal or vertical bars.
bar(Y) draws one bar for each element in Y. If Y is a matrix, bar groups the bars produced
by the elements in each row. The x-axis scale ranges from 1 up to length(Y) when Y is a
vector, and 1 to size(Y,1), which is the number of rows, when Y is a matrix.

barh(...) and h = barh(...) create horizontal bars. Y determines the bar length. The vector x is
a vector defining the y-axis intervals for horizontal bars.

9. plot ( 2-D line plot) :


plot(Y) Plots the columns of Y versus their index if Y is a real number. If Y is complex,
plot(Y) is equivalent to plot(real(Y),imag(Y)). In all other uses of plot, the imaginary
component is ignored.

plot(X1,Y1,...) Plots all lines defined by Xn versus Yn pairs. If only Xn or Yn is a matrix,


the vector is plotted versus the rows or columns of the matrix,

10. input (Request user input) : The response to the input prompt can be any MATLAB
expression, which is evaluated using the variables in the current workspace.
user_entry = input('prompt') Displays prompt as a prompt on the screen, waits for input
from the keyboard, and returns the value entered in user_entry. user_entry = input('prompt',
's') returns the entered string as a text variable rather than as a variable name or numerical
value.

11. zeros (Create array of all zeros) :

Department of Electronics and Communication Engineering


B = zeros(n) Returns an n-by-n matrix of zeros. An error message appears if n is not a
scalar.

12. ones (Create array of all ones) :

Y = ones(n) Rreturns an n-by-n matrix of 1s. An error message appears if n is not a scalar.

13. exp (Exponential) :

Y = exp(X) The exp function is an elementary function that operates element-wise on


arrays. Its domain includes complex numbers.

Y = exp(X) returns the exponential for each element of X.

14. disp (Display text or array) :

disp(X) Displays an array, without printing the array name. If X contains a text string, the
string is displayed. Another way to display an array on the screen is to type its name, but this
prints a leading "X=," which is not always desirable. Note that disp does not display empty
arrays.

15. conv (Convolution and polynomial multiplication) :

w = conv(u,v) convolves vectors u and v. Algebraically, convolution is the same operation


as multiplying the polynomials whose coefficients are the elements of u and v.

16. xcorr (Cross-correlation) :

c = xcorr(x,y) returns the cross-correlation sequence in a length 2*N-1 vector, where x and
y are length N vectors (N>1). If x and y are not the same length, the shorter vector is zero-
padded to the length of the longer vector.

17. filter (1-D digital filter) :

y = filter(b,a,X) filters the data in vector X with the filter described by numerator
coefficient vector b and denominator coefficient vector a. If a(1) is not equal to 1, filter
normalizes the filter coefficients by a(1). If a(1) equals 0, filter returns an error.

18. poly (Polynomial with specified roots) :

Department of Electronics and Communication Engineering


r = roots(p) which returns a column vector whose elements are the roots of the polynomial
specified by the coefficients row vector p. For vectors, roots and poly are inverse functions of
each other, up to ordering, scaling, and round off error.

19. tf(Convert unconstrained MPC controller to linear transfer function) :

sys=tf(MPCobj) The tf function computes the transfer function of the linear controller
ss(MPCobj) as an LTI system in tf form corresponding to the MPC controller when the
constraints are not active. The purpose is to use the linear equivalent control in Control
System Toolbox for sensitivity and other linear analysis.

20. freqz (Frequency response of filter ) :


[h,w] = freqz(ha) returns the frequency response vector h and the corresponding
frequency vector w for the adaptive filter ha. When ha is a vector of adaptive filters, freqz
returns the matrix h. Each column of h corresponds to one filter in the vector ha.

21. abs (Absolute value and complex magnitude) :

abs(X) returns an array Y such that each element of Y is the absolute value of the
corresponding element of X.

22. fft (Discrete Fourier transform) :


Y = fft(X) Y = fft(X) returns the discrete Fourier transform (DFT) of vector X, computed
with a fast Fourier transform (FFT) algorithm.

23. mod (Modulus after division) :

M = mod(X,Y) returns X - n.*Y where n = floor(X./Y). If Y is not an integer and the


quotient X./Y is within round off error of an integer, then n is that integer. The inputs X and
Y must be real arrays of the same size, or real scalars.

24. sqrt (Square root) :

B = sqrt(X) returns the square root of each element of the array X. For the elements of X
that are negative or complex, sqrt(X) produces complex results.

25. ceil (Round toward infinity) :

B = ceil(A) rounds the elements of A to the nearest integers greater than or equal to A. For
complex A, the imaginary and real parts are rounded independently.

26. fir1(Window-based finite impulse response filter design) :


Department of Electronics and Communication Engineering
b = fir1(n,Wn) returns row vector b containing the n+1 coefficients of an order n lowpass FIR
filter. This is a Hamming-window based, linear-phase filter with normalized cutoff frequency
Wn. The output filter coefficients, b, are ordered in descending powers of z.

27. buttord (Butterworth filter order and cutoff frequency) :

[n,Wn] = buttord(Wp,Ws,Rp,Rs) returns the lowest order, n, of the digital Butterworth filter
that loses no more than Rp dB in the passband and has at least Rs dB of attenuation in the
stopband. The scalar (or vector) of corresponding cutoff frequencies, Wn, is also returned. Use
the output arguments n and Wn in butter.

28. fliplr (Flip matrix left to right) :

B = fliplr(A) returns A with columns flipped in the left-right direction, that is, about a vertical
axis.If A is a row vector, then fliplr(A) returns a vector of the same length with the order of its
elements reversed. If A is a column vector, then fliplr(A) simply returns A.

29. min ( Smallest elements in array) :

C = min(A) returns the smallest elements along different dimensions of an array. If A is a


vector, min(A) returns the smallest element in A. If A is a matrix, min(A) treats the columns
of A as vectors, returning a row vector containing the minimum element from each column.
If A is a multidimensional array, min operates along the first non singleton dimension.

30. max ( Largest elements in array) :

C = max(A) returns the largest elements along different dimensions of an array. If A is a


vector, max(A) returns the largest element in A. If A is a matrix, max(A) treats the columns of
A as vectors, returning a row vector containing the maximum element from each column. If A
is a multidimensional array, max(A) treats the values along the first non-singleton dimension
as vectors, returning the maximum value of each vector.

31. find (Find indices and values of nonzero elements) :

ind = find(X) locates all nonzero elements of array X, and returns the linear indices of those
elements in vector ind. If X is a row vector, then ind is a row vector; otherwise, ind is a column
vector. If X contains no nonzero elements or is an empty array, then ind is an empty array.

32. residuez (z-transform partial-fraction expansion ) :

Department of Electronics and Communication Engineering


[r,p,k] = residuez(b,a) finds the residues, poles, and direct terms of a partial fraction
expansion of the ratio of two polynomials, b(z) and a(z). Vectors b and a specify the
coefficients of the polynomials of the discrete-time system b(z)/a(z) in descending powers of z.

33. angle (Phase angle) :

P = angle(Z) returns the phase angles, in radians, for each element of complex array Z. The
angles lie between + π and – π.

34. log (Natural logarithm ) :

Y = log(X) returns the natural logarithm of the elements of X. For complex or negative z,
where z = x +y*i , the complex logarithm is returned.

PART 2 : Basic Plotting of Signals

THEORY
Singularity functions are an important classification of non-periodic signal. They can be used to
represent more complicated signal. Some of them are unit impulse function, step function, ramp
function.
1. Unit Impulse Function is defined as :-

1 otherwise
2. Unit Step Function is defined as :-

3. Unit Ramp Function is defined as :-

PROGRAMS:

RESULTS:

Department of Electronics and Communication Engineering


QUESTIONS & ANSWERS

Q-1 What are the major classifications of signal?

Q-2 Describe the procedure used to determine whether the sum of two periodic signals is periodic or
not.

Q-3 With suitable examples distinguish a deterministic signal from a random signal.

Q-4 Writes the mathematical and graphical representation of a unit sample sequence and a unit-step
sequence.

Department of Electronics and Communication Engineering


EXPERMENTAL NO.-2
Object: BASIC PLOTTING OF SIGNALS

clc
clear all
close all
t=0:0.1:2*pi;
x=sin(2*pi*t)
subplot(2,2,1)
plot(t,x)
xlabel('t')
ylabel('x(t)')
title('continuos plot of sine wave')

clc
clear all
close all
t=0:0.1:2*pi;
x=sin(2*pi*t)
x1=cos(2*pi*t)
subplot(2,2,1)
plot(t,x)
xlabel('t')
ylabel('x(t)')
title('continuos plot of sine wave')
subplot(2,2,2)
stem(t,x)
xlabel('n')
ylabel('x(n)')
title('discrete plot of sine wave')
subplot(2,2,3)
plot(t,x1)
xlabel('t')
ylabel('x1(t)')
title('continuos plot of cos wave')

Department of Electronics and Communication Engineering


subplot(2,2,4)
stem(t,x1)
xlabel('n')
ylabel('x1(n)')
title('discrete plot of cos wave')

clc
clear all
close all
t=0:0.1:2*pi;
x=sin(2*pi*t)
subplot(3,2,1)
plot(t,x)
xlabel('t')
ylabel('x(t)')
title('continuos plot of sine wave')
subplot(3,2,2)
x1=exp(-2*t)
plot(t,x1)
xlabel('t')
ylabel('x(t)')
title('continuos plot of EXPO wave')
subplot(3,2,3)
r=t
Department of Electronics and Communication Engineering
plot(t,r)
xlabel('t')
ylabel('r(t)')
title('continuos plot of RAMP wave')
subplot(3,2,4)
x2=log(t)
plot(t,x2)
xlabel('t')
ylabel('log(t)')
title('continuos plot of LOG wave')
subplot(3,2,5)
n=-5:1:5
x3=[zeros(1,5),ones(1,1) zeros(1,5)]
stem(n,x3)
xlabel('-->n')
ylabel('unit impulse')
title(' discrete plot of unit impulse function')
subplot(3,2,6)
n=0:1:10
x4=[ones(1,11)]
stem(n,x4)
xlabel('-->n')
ylabel('unitstep')
title('discrete plot of unit step function')

Department of Electronics and Communication Engineering


EXPERIMENT NO.-3
AIM:

Write a MATLAB program to perform amplitude –scaling, time-scaling and time shifting on a given signal
by defining functions.

EQUIPMENT REQUIRED:

1. PC installed with MATLAB software (7.12.0(R2011a) version).


2. Printer.

THEORY:

PROGRAMS:

RESULTS:

Department of Electronics and Communication Engineering


QUESTIONS & ANSWERS

Q-1 The give signal is written as : y(t) = -2 * x(0.5t -1)


Perform Amplitude scaling, time scaling & time shifting and check using MATLAB.

Q-2 Write A MATLAB Program for following signals.

Q-3 Write A MATLAB Program for following signals.

Department of Electronics and Communication Engineering


EXPERMENTAL NO.-3
Write a MATLAB program to perform amplitude –scaling, time-scaling and time shifting on a given signal
by defining functions.

clc
close all
clear all
t=-15:0.01:15;
subplot(4,2,1)
x=sinc(t)
plot(t,x)
xlabel('t')
ylabel('x(t)')
title('original signal')

t=-15:0.01:15;
subplot(4,2,2)
x=sinc(t-2)
plot(t,x)
xlabel('(t-2)')
ylabel('x(t)')
title('shifted signal(delay)')

t=-15:0.01:15;
subplot(4,2,3)
x=sinc(t+2)
plot(t,x)
xlabel('(t+2)')
ylabel('x(t)')
title('shifted signal(advance)')

t=-15:0.01:15;
subplot(4,2,4)
x=sinc(2*t)
plot(t,x)
xlabel('(2t)')
ylabel('x(t)')
title('scaled signal(compressed)')

t=-15:0.01:15;

Department of Electronics and Communication Engineering


subplot(4,2,5)
x=sinc(t/2)
plot(t,x)
xlabel('(t/2)')
ylabel('x(t)')
title('scaled signal(expended)')
t=-15:0.01:15;
subplot(4,2,6)
x=sinc(-t)
plot(t,x)
xlabel('-t')
ylabel('x(t)')
title('time reversal')

t=-15:0.01:15;
subplot(4,2,7)
x=5*sinc(t)
plot(t,x)
xlabel('t')
ylabel('5x(t)')
title('Amplication')

t=-15:0.01:15;
subplot(4,2,8)
x=(sinc(t))/2
plot(t,x)
xlabel('t')
ylabel('(x(t))/2')
title('Deamplification')

Department of Electronics and Communication Engineering


Department of Electronics and Communication Engineering
EXPERIMENT NO.-4

AIM:
1. Write a MATLAB program to obtain linear convolution of the given CT and DT sequence using the
function conv.
2. Compare and verify the result obtained with the expected theoretical results.
EQUIPMENT REQUIRED:

1. PC installed with MATLAB software (7.12.0(R2011a) version).


2. Printer.

THEORY:

The convolution of two signals ( ) and ( ) is define as

( ) ( ) ∫ ( ) ( )
The convolution sum of two sequence ( ) and ( ) is define as

( ) ( ) ∑ ( ) ( )

In general, if the lengths of the two sequences being convolved are M and N, then the sequence
generated by the convolution is of length M+N-1

ALGORITHM

For convolution:-

1. Get two signals ( ) and ( )) in matrix form.


2. The convoluted signal is denoted as y(n).
3. Y(n) is given by formula
4. Stop.

PROGRAMS:

RESULTS:

Department of Electronics and Communication Engineering


QUESTIONS & ANSWERS

Q-1 Write MATLAB program for the following using convolution

( ) ( ) ( ) Where
( ) ( ) ( ) ( ) ( )

Q-2 Write MATLAB program following convolutions, , - , -


a) , - , - , - , - , -

) , - , - , - , -

Q-3 Define convolution theorem for LTI systems.

Department of Electronics and Communication Engineering


EXPERMENTAL NO.-4

Write a MATLAB program to obtain linear convolution of the given CT and DT sequence using the
function conv.

Continuous time convolution


clc
close all
clear all
t=0:0.01:2*pi;
x1= cos(t);
x2= exp(t);
y=conv(x1,x2)
subplot(3,1,1)
plot(x1)
ylabel('cos(t)')
xlabel('--->t')
title('First Signal')
subplot(3,1,2)
plot(x2)
ylabel('exp(t)')
xlabel('--->t')
title('Second Signal')
subplot(3,1,3)
plot(y)
ylabel('y(t))')
xlabel('--->t')
title('Convolved Signal')

Department of Electronics and Communication Engineering


Department of Electronics and Communication Engineering
Discrete time convolution
clc
close all
clear all

x1= input('Enter First sequence')


x2= input('Enter Second sequence')
y=conv(x1,x2)

subplot(3,1,1)
stem(x1)
ylabel('First sequence')
xlabel('--->n')
title('First Sequence')

subplot(3,1,2)
stem(x2)
ylabel('Second sequence')
xlabel('--->n')
title('Second Sequence')

subplot(3,1,3)
stem(y)
ylabel('conv.')
xlabel('--->n')
title('Convolved Sequence')

input=
Enter First sequence[3 5 4 78 3 7 21 9 6 3 54 65 78 23 12 0 0 34 87 0 0 0
23]
Enter Second sequence[0 0 0 0 0 0 2 3 45 63 23 8 67 43 14 87 95 23 5 6 12
34 43]

Department of Electronics and Communication Engineering


Department of Electronics and Communication Engineering
EXPERIMENT NO.-5
AIM:
1. Write a MATLAB program to compute autocorrelation of a sequence x(n) and verify the
property.
2. Write a MATLAB program to compute cross-correlation of a sequence x(n) and y(n) and
verify the property.
EQUIPMENT REQUIRED:
1. PC installed with MATLAB software (7.12.0(R2011a) version).
2. Printer.
THEORY:

The Cross correlation of two signals ( ) and ( ) is define as

( ) ∫ ( ) ( )

The Auto correlation of signals ( ) is define as

( ) ∫ ( ) ( )

The Cross correlation of two sequence ( ) and ( ) is define as

() ∑ ( ) ( )

The Auto correlation of sequence ( ) is define as

() ∑ ( ) ( )

ALGORITHM For Correlation:-


1. Get two signals x(m) & h(p) in matrix form.
2. The correlated signal is denoted as y (n).
3. Y(n) is given by formula
4. Stop.

PROGRAMS:
RESULTS:
Department of Electronics and Communication Engineering
QUESTIONS & ANSWERS

Q-1 Define Cross correlation and auto correlation function. Where it is applicable.

Q-2 Write MATLAB program for Cross correlation of following signals


a) ( ) ( )
b) ( ) ( )

Q-3 Write MATLAB program for Auto correlation of following signals.


( ) * +

Department of Electronics and Communication Engineering


EXPERMENTAL NO.-5
Write a MATLAB program to compute Auto and cross-correlation of a sequence x(n) and y(n) and verify the
property.

clc
close all;
clear all;
t=0:0.01:4*pi;
subplot(4,2,1)
x=sin(t);
plot(t,x)
title('first signal')

subplot(4,2,2)
y=exp(t);
plot(t,y)
title('second signal')

subplot(4,2,3)
y1=xcorr(x,x);
plot(y1)
title('auto correlation of first signal')

subplot(4,2,4)
y2=xcorr(y,y);
plot(y2)
title('auto correlation of second signal')

subplot(4,2,5)
y3=xcorr(x,y);
plot(y3)
title('cross correlation of signal x,y')

subplot(4,2,6)
y4=conv(x,exp(-1*t));
plot(y4)
title('convulation of first signal and reversal of second signal')

Department of Electronics and Communication Engineering


Department of Electronics and Communication Engineering
EXPERIMENT NO.-6
AIM:
1. To calculate Fourier Series coefficients associated with Square Wave and Triangular wave.
2. To sum the first 10 terms and plot the Fourier series as a function of time
3. To sum the first 50 terms and plot the Fourier Series as a function of time

EQUIPMENT REQUIRED:

1. PC installed with MATLAB software (7.12.0(R2011a) version).


2. Printer.

THEORY:

The infinite series of sine and cosine term of frequencies is known as


trigonometric form of Fourier series and define as

( ) ∑

Where are called Fourier series coefficients and define as

∫ ( )

∫ ( )

∫ ( )

ALGORITHM

1. Enter the number of coefficient required.


2. Enter the equation for first half.
3. Enter the equation for second half.
4. Enter period of the signal
5. Enter discontinuity moment as per requirement.

PROGRAMS:

RESULTS:

Department of Electronics and Communication Engineering


QUESTIONS & ANSWERS

Q-1 Find the Fourier series for (periodic extension of). Also find the sum of Series

Q-2. Find the Fourier series for (periodic extension of).Also find the sum of Series.

Q-3 State Dirichlet’s conditions for a function to be expanded as a Fourier series.

Q-4 State the convergence condition on Fourier series.

Department of Electronics and Communication Engineering


EXPERMENTAL NO.-6

To calculate Fourier Series coefficients associated with Square Wave and Triangular wave.
clc
clear all
close all

t=-3*pi:0.001:3*pi;

A=30;
f=1/(2*pi);
y=A*square(2*pi*f*t);
plot(t,y)
grid on;
title('Periodic Rectangular signal');

N=50;
n=0:N-1;
n1=2*n+1;
for i=1:N
y1(i)=4*A/(pi*n1(i));
y2(i,:)=((4*A)/(pi*n1(i)))*(sin(2*pi*f*n1(i)*t));
end

figure;
stem(n1,y1);
title('Discrete fourier spectrum C_n')
y3(i,:)=sum(y2);
figure
plot(t,y3)
title('Reconstructed rectangular signal from coefficient')

Department of Electronics and Communication Engineering


Department of Electronics and Communication Engineering
EXPERIMENT NO.-7
AIM:
1. Calculate Fourier Transform of a given signal and plot the magnitude and the phase spectrum.
2. Calculate the Z-transform of a given signal and plot the poles and zeros of the Z-transform

EQUIPMENT REQUIRED:

1. PC installed with MATLAB software (7.12.0(R2011a) version).


2. Printer.

THEORY:

(1) The frequency spectrum of a non- periodic function ( ) is represented by ( ) and define as

( ) ∫ ( )

It is called Fourier transform or the Fourier integral of ( ).In genral ( ) is a complex


function of and written as:
( ) ( ) ( )

Where ( ) is the real part and ( ) is the imaginary part of ( ).

The Magnitude of ( ) is given by

| ( )| √ ( ) ( )

And the phase of ( ) is given by

( )
( )
( )
The plot of | ( )| verses is known as Amplitude spectrum and the plot of ( ) verses
is known as phase spectrum.
(2) The Z transform of a discrete time sequence is define as

( ) ∑ ( )

Where is a coplex variable and is given by


Department of Electronics and Communication Engineering
Where is radius of circle.

ALGORITHM

1. Enter the input signal.


2. Perform Fourier operation on input signal
3. Display Fourier transform of input signal
4. Display magnitude spectrum and phase spectrum of signal
5. Plot all above given signals.
6. Repeat step 1
7. Perform Z transform.
8. Plot poles and zero of Z transform
9. Stop

PROGRAMS:

RESULTS:

Department of Electronics and Communication Engineering


QUESTIONS & ANSWERS

Q-1 Find the Fourier Transform of cosine signal. Also Draw phase and magnitude spectrum.

Q-2. Find the Z transform of given signal. Explain ROC also.

Q-3 State Dirichlet’s conditions for a function to be expanded as a Fourier Transform.

Q-4 State the convergence and existence condition on Z Transform.

Department of Electronics and Communication Engineering


EXPERMENTAL NO.-7
Write MATLAB Programming for Fourier Transform of a given signal and plot the magnitude and the phase
spectrum

clc
clear all
close all

sysm t w;
a=2;
x=exp(-a*t)*heaviside(t);
subplot(3,1,1)
ezplot(x);
title('Input Signal');
xlabel('t');
ylabel('Amplitude');

disp('The Forier Transform of x(t)is');


x=fourier(x);
x=simplify(x);

subplot(3,1,2)
ezplot(abs(x));
title('Magnitude Response');
subplot(3,1,3)
ezplot(atan((imag(x))/(real(x))));

Department of Electronics and Communication Engineering


Write MATLAB Programming for the Z-transform of a given signal and plot the poles and zeros of the Z-
transform

clc
clear all
close all

num=[10]
den=[1 12 44 48 0]
H= tf(num,den)

zplane(num,den)
title('Pole-Zero Plot')
grid on

Department of Electronics and Communication Engineering


EXPERIMENT NO.-8
AIM:
1. Write a MATLAB program to find the impulse response and step response of a system from
its difference equation.
2. Compute and plot the sequence of a given system to a given input.

EQUIPMENT REQUIRED:
1) PC installed with MATLAB software (7.12.0(R2011a) version).
2) Printer.
THEORY:
The impulse response of a given system is its response to impulse function input and when input is
unit step function, the output response of a system is called step response of system.
If system is specified by differential equation
( ) ( ) ( ) ( ) ( )
1). Use Fourier transforms of given equation and calculates
( )
( )
( )

2). Use partial fraction to break ( ) as sum of first order terms


3). Take inverse Fourier transform to find impulse response ( ).
4). Put value of input signal ( ) ( ) and find step response
( ) ( ) ( )
ALGORITHM:
1. Start
2. Input the coefficients of x(n).
3. Generate impulse signal.
4. Input the coefficients of y(n).
5. Obtain the impulse response using filter function
6. Plot the impulse response.
7. Generate step signal.
8. Obtain the step response using filter function.
9. Plot the step response.
10. Stop.

PROGRAMS:
RESULTS:

Department of Electronics and Communication Engineering


QUESTIONS & ANSWERS

Q1. How to evaluate an impulse/response model in MATLAB

Q2. Define continuous time unit step and unit impulse.

Q3. Write a Matlab program for the impulse response of this system is ( ) ( )

Department of Electronics and Communication Engineering


EXPERMENTAL NO.-8
Write a MATLAB program to find the impulse response and step response of a system from its difference
equation

clc
clear all
close all

x=[1 1];
y=[1 0.7];
n= -20:1:20;
imp=[zeros(1,20),ones(1,1),zeros(1,20)]
h=filter(x,y,imp);
subplot(2,1,1);
stem(n,h)
title('Impulse Response');
xlabel('Sample');
ylabel('Amplitude');

stp=[zeros(1,20),ones(1,21)];
h=filter(x,y,stp);
subplot(2,1,2);
stem(n,h)
title('Step Response');
xlabel('Sample');
ylabel('Amplitude');

Department of Electronics and Communication Engineering


EXPERIMENT NO.-9
AIM:
1. For a given system function write a MATLAB program to plot the poles, zero configuration
and Bode plot.
2. Analyze the stability of the given system from the Bode plot
EQUIPMENT REQUIRED:

1. PC installed with MATLAB software (7.12.0(R2011a) version).


2. Printer.

THEORY: The unilateral Z-Transform of a digital sequence x[n] is given by

System transfer Functions: Now we are in a position to make it easier to manipulate difference
equations using the Z-transform, in the same way that we can use the Laplace transform to help us
solve differential equations.

The function Y(z)/ X(z) is the SYSTEM TRANSFER FUNCTION for the difference equation.
And given x[n] we can use the above to work out the output given any input using the Z-
transform.
Poles and Zeros: Same deal as for analogue systems. Poles are the values of z that make the
denominator zero, and zeros are the values of z that make the numerator go to zero.

Department of Electronics and Communication Engineering


ALGORITHM

1. Enter the number of coefficient of a system.


2. Enter the denominator of function.
3. Enter the Numerator of function.
4. Calculate residue of NUM and DENOM
5. Calculate Transfer function of system.
6. Plot pole- zero of transfer function.
7. Stop.

PROGRAMS:

RESULTS:

QUESTIONS & ANSWERS

Q1.Difrensiate between Z transform and Laplace transform.

Q2. Define ROC and Poles zeros in Z plane.

Q3. Write a Matlab program for the impulse response of this system is ( ) ( ) using Z
transform.

Department of Electronics and Communication Engineering


EXPERMENTAL NO.-9
For a given system function write a MATLAB program to plot the poles, zero configuration and Bode plot.

Clc
clear all
close all

num=[10]
den=[1 11 10 0]
H= tf(num,den)

bode(H)
grid on
[GM,PM,Wgc,Wpc]=margin(H)
margin(H)

Department of Electronics and Communication Engineering


EXPERIMENT NO.-10
AIM:
1. Write a MATLAB program to plot the frequency response of the first order system.
2. Also write MATLAB program to calculate the rise time and bandwidth of same system.
EQUIPMENT REQUIRED:

1. PC installed with MATLAB software (7.12.0(R2011a) version).


2. Printer.
THEORY:
The frequency response of a system is the major way of characterizing how a system behaves in the
frequency domain. It is important to understand the frequency characteristics of a given system
rather than time domain characteristics alone for many practical applications like filter design.

The frequency response of a system, H ( ) is just the transfer function, H (s) evaluated at
s  j . Frequency response is usually a complex valued function, so it can be written as

Department of Electronics and Communication Engineering


H ( )  H ( ) H ( ) , where H ( ) is the magnitude response and H ( ) is the phase response.
You can use MATLAB to plot the magnitude and phase responses as follows:

( s  1) s 1
Example: H ( s)   2 , to plot magnitude and phase responses use the following
( s  4) 2
s  8s  8
command lines. Define two vectors b and a where b is the coefficients of the polynomial in the
numerator, and a is the coefficients of the polynomial in the numerator.

Note that they have to be the same length and start with the coefficient of the highest order term.
Then define was the vector of frequencies over which you want to plot the magnitude and phase
responses.

ALGORITHM

1. Enter the number of coefficient of a system.


2. Enter the denominator of function.
3. Enter the Numerator of function.
4. Calculate residue of NUM and DENOM
5. Calculate Transfer function of system.
6. Plot Phase and Magnitude response of transfer function.
7. Stop.
PROGRAMS:

RESULTS:

QUESTIONS & ANSWERS

Q1. Write the condition of ROC and existence of Laplace Transform.

Department of Electronics and Communication Engineering


Q2. Define continuous time unit step and unit impulse response of a system.

Q3. Write a Matlab program for Laplace transform of following signal ( ) ( )

EXPERMENTAL NO.-10
Write a MATLAB program to plot the frequency response of the first order system.
( s  1) s 1
H ( s)   2
( s  4) 2
s  8s  8
b=[0 1 -1];

a=[1 8 8];

w=[0:.1:2*pi];

freqs (b,a,w)

Department of Electronics and Communication Engineering


-0.87
10
Magnitude

-0.96
10
-1 0
10 10
Frequency (rad/s)
200
Phase (degrees)

150

100

50

-50
-1 0
10 10
Frequency (rad/s)

EXPERIMENT NO.-11
AIM:
a. Build a system that amplifies a sine wave by a factor of two.
b. Test the linearity of this system using SIMULINK

EQUIPMENT REQUIRED:
1. PC installed with MATLAB software (7.12.0(R2011a) version).
2. Printer.

THEORY:
This model shows a standard inverting op-amp circuit. The gain is given by -R2/R1, and with the
values set to R1=10K Ohm and R2=20K Ohm, the 1V peak-to-peak input voltage is amplified to 2V
Department of Electronics and Communication Engineering
peak-to-peak. As the Op-Amp block implements an ideal (i.e. infinite gain) device, this gain is
achieved regardless of output load.

ALGORITHM:
 Start Simulink platform.
 Draw the block diagram using different blocks.
 Generate input signal using blocks.
 Connect output port to virtual oscilloscope.
 Connect input port to virtual oscilloscope.
 Save the Simulink.
 Obtain the response using simulation.
 Stop.
Simulink Model and Results:
QUESTIONS & ANSWERS
Q1 what do you mean by linearity of a system?

Q2 WAMP for calculating linearity of a system.


Department of Electronics and Communication Engineering
Q3 what are the significances of linearity

EXPERMENTAL NO.-11
Build a system that amplifies a sine wave by a factor of two

Department of Electronics and Communication Engineering


EXPERIMENT NO.-12 (Beyond Syllabus)

AIM

Department of Electronics and Communication Engineering


Write a MATLAB program for understanding Sampling theorem.

EQUIPMENT REQUIRED:

1. PC installed with MATLAB software (7.12.0(R2011a) version).


2. Printer.

THEORY
The Sampling theorem can be understood well with the following inputs:

Frequency analysis of the amplitude modulated discrete-time signal

X(n) = cos 2f1n +cos2f2n

Where f1= 1/128 and f2 = 5/128 modulates the amplitude-modulated signal is

Xc(n) = cos2fcn

Where fc =50/128. the resulting amplitude-modulated signal is

Xam (n) =x(n) cos2fcn

ALGORITHM

1.sketch the signals x(n),xc (n) and xam (n) ,0≤ n ≤ 255.

PROGRAMS:

RESULTS:

QUESTIONS & ANSWERS


Q- 1 what is meant by sampling? State the sampling theorem.

Department of Electronics and Communication Engineering


Q- 2 Explain how sampling can be done with an impulse function.

Q- 3 Draw the spectrum of a sampled signal and explain aliasing.

Q- 4 Explain the process of reconstruction of the signal from its samples. Obtain the impulse
response of an ideal reconstruction filter.

EXPERMENTAL NO.-12

Write a MATLAB program for understanding Sampling theorem.


clc
Department of Electronics and Communication Engineering
close all;
clear all;
t=-10:0.001:10;
fm=0.1;
xt= cos(2*pi*fm*t);
subplot(2,2,1);
plot(t,xt);
title('continuous time signal x(t)')
fs1=0.1;n1=-5:5;
x1n=cos(2*pi*fm*n1/fs1);
subplot(2,2,2);
stem(n1,x1n);
title('sampled signal with fs<2fm')
fs2=0.2;
n2=-5:5;
x2n=cos(2*pi*fm*n2/fs2);
subplot(2,2,3);
stem(n2,x2n);
title('sampled signalwith fs=2fm');
fs3=0.8;
n3=n-10:10;
x3n=cos(2*pi*fm*n3/fs3);
subplot(2,2,4);
stem(n3,x3n);title('sampled signal with fs>2fm');

EXPERIMENT NO.-13(Beyond Syllabus)


AIM:
Write a MATLAB Program for understand stability Test.
EQUIPMENT REQUIRED:
Department of Electronics and Communication Engineering
1. PC installed with MATLAB software (7.12.0(R2011a) version).
2. Printer.

THEORY:

The stability of discrete time LTI system is equivalent to its impulse response being absolutely
summable, i.e.

∑ | ( )|

In this case the DTFT of h(n) converges and the ROC of transfer function H(Z) must include the
unit circle |Z|=1. A discrete time LTI system is stable if and only if ROC of its transfer function H(Z)
include the unit circle |Z|=1.

It is perfectly possible for a system to be stable and not causal. For causal systems, stability can
easily be checked by examining the locations of poles in transfer function H(Z). for a causal discrete
time LTI system with rational transfer function H(Z), the ROC is outside the outermost pole. A
causal discrete time LTI system with rational transfer function H(Z), is stable if and only if all of the
poles of H(Z) lie inside the unit circle |Z|=1.

ALGORITHM

1. Enter the number of coefficient of a system.


2. Enter the equation for stability.
3. Check system is stable or not.
4. Display system stability.
5. Stop.

PROGRAMS:

RESULTS:

QUESTIONS & ANSWERS


Q1 what do you mean by stability of a system? Explain

Department of Electronics and Communication Engineering


Q2 WAMP for finding stability of a given system.

Q3 Write any three methods for calculating stability of a system.

Q4 write the condition for BIBO Stability.

EXPERMENTAL NO.-13
Write a MATLAB program for Test the Stability of the system

Department of Electronics and Communication Engineering


Clc;

clear all;

close all;

b=input('Enter the denominator coefficients of the filter');

k=poly2rc(b);

knew=fliplr(k);

s=all(abs(knew));

if(s==1);

disp('"Stable system"');

else

disp('"Non stable system"');

end

RESULT:

Enter the denominator coefficients of the filter [1 -1 .5]

b =1.0000 -1.0000 0.5000

“Stable system”

Department of Electronics and Communication Engineering

You might also like