Professional Documents
Culture Documents
SAS Lab Manual For 17-18
SAS Lab Manual For 17-18
LAB MANUAL
ACADEMIC SESSION 2018-19
Syllabus
Practical Outcome
Session Plan
Evaluation sheet
Each experiment should be with post lab questions with answer key
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
REC353.03 Examine linear convolution, autocorrelation and cross-correlation, Fourier series expansion
REC353.04 Analysis of system with respect to the impulse response and step response, pole-zero diagram &
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
CREDIT : 01
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.
Reference Books:
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
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
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
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, 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
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'.
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:
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:
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
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:
Elementary functions:
The elementary functions can be found by typing help elfun. The most basic functions follow.
Trigonometric.
sin - Sine.
cos - Cosine.
tan - Tangent.
sec - Secant.
csc - Cosecant.
cot - Cotangent.
Exponential.
exp - Exponential.
Complex.
sign - Signum.
Remember to use the help command to get more information for any of those functions.
Flow control:
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:
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:
Q-4 Write the MATLAB command used to display more than one plot in same figure
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:
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 :
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
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.
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.
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.
Y = ones(n) Rreturns an n-by-n matrix of 1s. An error message appears if n is not a scalar.
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.
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.
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.
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.
abs(X) returns an array Y such that each element of Y is the absolute value of the
corresponding element of X.
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.
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.
[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.
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.
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.
P = angle(Z) returns the phase angles, in radians, for each element of complex array Z. The
angles lie between + π and – π.
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.
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 :-
PROGRAMS:
RESULTS:
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.
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')
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')
Write a MATLAB program to perform amplitude –scaling, time-scaling and time shifting on a given signal
by defining functions.
EQUIPMENT REQUIRED:
THEORY:
PROGRAMS:
RESULTS:
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;
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')
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:
THEORY:
( ) ( ) ∫ ( ) ( )
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:-
PROGRAMS:
RESULTS:
( ) ( ) ( ) Where
( ) ( ) ( ) ( ) ( )
) , - , - , - , -
Write a MATLAB program to obtain linear convolution of the given CT and DT sequence using the
function conv.
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]
( ) ∫ ( ) ( )
( ) ∫ ( ) ( )
() ∑ ( ) ( )
() ∑ ( ) ( )
PROGRAMS:
RESULTS:
Department of Electronics and Communication Engineering
QUESTIONS & ANSWERS
Q-1 Define Cross correlation and auto correlation function. Where it is applicable.
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')
EQUIPMENT REQUIRED:
THEORY:
( ) ∑
∫ ( )
∫ ( )
∫ ( )
ALGORITHM
PROGRAMS:
RESULTS:
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.
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')
EQUIPMENT REQUIRED:
THEORY:
(1) The frequency spectrum of a non- periodic function ( ) is represented by ( ) and define as
( ) ∫ ( )
| ( )| √ ( ) ( )
( )
( )
( )
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
( ) ∑ ( )
ALGORITHM
PROGRAMS:
RESULTS:
Q-1 Find the Fourier Transform of cosine signal. Also Draw phase and magnitude 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');
subplot(3,1,2)
ezplot(abs(x));
title('Magnitude Response');
subplot(3,1,3)
ezplot(atan((imag(x))/(real(x))));
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
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
( )
( )
( )
PROGRAMS:
RESULTS:
Q3. Write a Matlab program for the impulse response of this system is ( ) ( )
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');
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.
PROGRAMS:
RESULTS:
Q3. Write a Matlab program for the impulse response of this system is ( ) ( ) using Z
transform.
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)
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
( 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
RESULTS:
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)
-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?
EXPERMENTAL NO.-11
Build a system that amplifies a sine wave by a factor of two
AIM
EQUIPMENT REQUIRED:
THEORY
The Sampling theorem can be understood well with the following inputs:
Xc(n) = cos2fcn
ALGORITHM
1.sketch the signals x(n),xc (n) and xam (n) ,0≤ n ≤ 255.
PROGRAMS:
RESULTS:
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
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
PROGRAMS:
RESULTS:
EXPERMENTAL NO.-13
Write a MATLAB program for Test the Stability of the system
clear all;
close all;
k=poly2rc(b);
knew=fliplr(k);
s=all(abs(knew));
if(s==1);
disp('"Stable system"');
else
end
RESULT:
“Stable system”