B20EN0502 Signals and Systems Lab Manual Final to Print
B20EN0502 Signals and Systems Lab Manual Final to Print
Communication Engineering
Program : B.Tech. in ECE
Signals and Systems(I) Lab
LABORATORY MANUAL
20EN0502
V Semester
2020-24
Rukmini Educational
Charitable Trust www.reva.edu.in
Vision of the University
‘’REVA University aspires to become an innovative university by developing excellent human
resources with leadership qualities, ethical and moral values, research culture and innovative skills
through higher education of global standards”
The Program Educational Objectives of B. Tech in B.Tech in ECE/ ECM Engineering are as
follows:
PEO -1: To have successful professional careers in industry, government, academia, and military as
innovative engineers.
PEO -2: To successfully solve engineering problems associated with the lifecycle of B.Tech in
ECE/ ECM Engineering Systems either leading a team or as a team member.
PEO -3: To continue to learn and advance their careers through activities such as participation in
professional organizations, attainment of professional certification for lifelong
learning and seeking higher education.
PEO -4: To be active members ready to serve the society locally and internationally and will undertake
entrepreneurship for the growth of economy and to generate employment.
Program Outcomes (POs)
On successful completion of the program, the graduates of B. Tech. in ECE/ ECM Engineering
program will be able to:
Practice 1 2 2
- - - - Theory Practical IA SEE
COURSE OVERVIEW:
The course covers the fundamentals of signal and system analysis tackling both continuous-time (CT) and discrete-time (DT)
systems. The course provides the necessary background needed for understanding analog and digital signal processing, automatic
control, analog and digital communications, and probability and random processes. The course focuses on the study of linear time-
invariant (LTI) systems and their analysis in the time domain or in the frequency domain. Fourier analysis in the course includes
Fourier series for periodic continuous-time signals, the continuous-time Fourier transform (CTFT) and the discrete-time Fourier
transform (DTFT). In addition the course includes a chapter on Z transform.
COURSE OBJECTIVES:
The objectives of this course are :
1. Provide insight into fundamentals of Continuous and Discrete-time signals and systems, their properties and representations.
2. Introduce time domain representation of Linear Time invariant Systems such as Convolution Sum, Convolution Integral.
3. Provide understanding of signal representation in Fourier domain such as Fourier Series, Fourier transform, discrete
time Fourier transform.
4. Provide insights into applications of Fourier transform and brief understanding of signal representation in Z-domain.
COURSE OUTCOMES(COs)
On successful completion of this course; the student shall be able to:
Illustrate the operations on Signals and summarize the properties of Systems. 1,2,3,4,5,9,10 1,2
CO1
Apply Convolution operation on an LTI System to calculate the output. 1,2,3,4,5,9,10 1,2
CO2
Represent the continuous and Discrete time periodic signals in frequency domain 1,2,3,4,5,9,10
CO3 and calculate the Fourier Coefficients 1,2,3
Represent the continuous and Discrete time Aperiodic signals in frequency domain 1,2,3,4,5,9,10
CO4 and interpret the Frequency Spectrum 1,2,3
Analyze the stability of Discrete time system by applying Z-transform. 1,2,3,4,5,9,10 1,2,3
CO5
Represent the discrete time system in Z-domain and determine the behavior of 1,2,3,4,5,9,10
CO6 Causal LTI system using properties of Z-Transform. 1,2,3
Bloom s Level
Remember Understand Apply Analyze Evaluate Create
CO# (L1) (L2) (L3) (L4) (L5) (L6)
CO1
CO2
CO3
CO4
CO5
CO6
PSO1
PSO2
PSO3
PO10
PO11
PO12
PO1
PO2
PO3
PO4
PO5
PO6
PO7
PO8
PO9
CO#/
POs
CO1 3 2 1 1 2 2 2 2 3
CO2 3 3 2 1 2 2 2 2 3
CO3 3 2 1 1 2 2 2 2 3
CO4 3 3 1 1 2 2 2 2 3
CO5 3 3 2 1 2 2 2 2 3
CO6 3 2 1 1 2 2 2 2 3
Note:1-Low,2-Medium,3-High
COURSE CONTENT
THEORY:
Contents
UNIT - 1
Introduction to Signals and Systems
Definitions of signals and systems, Elementary signals, Basic operations on signals, Classification of signals, Properties of
systems, Numerical on each topic.
UNIT - 2
Analysis of Linear Time Invariant Systems and Fourier Series
Time domain representation of LTI systems, Impulse response representation, Types of Convolution: Convolution Sum and
Integral, Fourier Representation of Periodic Signals: Analysis using CTFS and DTFS of basic signals.
Numerical on each topic.
UNIT - 3
Fourier Transform and its applications
FT representation of CT signals Definition of FT, FT of standard CT signals, Properties and their significance,
Inverse FT, Solvingdifferential equations using FT.
FT representation of DT signals-Definition of DTFT, DTFT of standard DT signals, Properties and their significance.
Numerical on each topic.
UNIT - 4
Z-Transforms and its applications
Z -Transforms: Definition, Properties of Z transform, ROC, Inversion of Z transforms, transform analysis of LTI Systems.Z-
Transforms and its application to solve difference equations. Numerical on each topic.
PRACTICE SESSION:
TEXT BOOKS:
1. Simon Haykin India Pvt Ltd, Second Edition, 2018.
2. S Palani, “Signals and Systems”,Springer International Publishing AG, Second Edition, 2021.
3. I J Nagrath, “Signals and Systems”, Tata McGraw Hill, 3rd edition, 2010.
REFERENCE BOOK:
1. Michael Rober
2. Allan V. Oppenheim, S. Wilsky and S.H Nawab, “Signals and Systems”, Pearson Education, Second Edition, 2019.
3. Benoit Boulet, “Fundamentals of Signals and Systems”, Da Vinci Engineering Press, 2nd edition, 2006.
SWAYAM/NPTEL/MOOCs:
1. https://nptel.ac.in/courses/108/104/108104100/
2. https://nptel.ac.in/courses/117/101/117101055/
3. https://nptel.ac.in/courses/108/106/108106163/
4. https://www.coursera.org/courses?query=signals%20and%20systems
5. https://nptel.ac.in/courses/117/104/117104074/
Contents
MATLAB Introduction
What is MATLAB?
It is very general, powerful and popular. By skill demand, it is one of the top 10 computer
languages. There is no field untouched and uninfluenced by it and is used by millions of people
from all walks of life – students, teachers, researchers etc - worldwide.
Just a pick of the several applications: MATLAB has been used in projects such as modelling
energy consumption to build smart power grids, developing control algorithms for hypersonic
vehicles, analyzing weather data to visualize the track and intensity of hurricanes, and running
millions of simulations to pinpoint optimal dosing.
Why?
BECAUSE MATLAB
• first and foremost, is easy to use. Just like how you write on paper. No variable
declarations, No dimension declarations, No type declarations, No inclusion of libraries and so
on. It is all about mathematical computations -everything from simple to most complex.
• data visualization– i.e. simple to powerful graphics like 3D and animated graphics.
• much much more - for example, symbolic math, importing and exporting of data,
programming, publishing and interfacing to hardware.
• The strength of MATLAB is its matrix-based operations. Ability to deal with several
numbers at the same time rather than one at a time.
• MATLAB handholds from conceptualization to hardware implementation and
acceptance.
• simply put, MATLAB is all about everything you need to do a job from concept to
using.
• superb documentation, embedded help, free source code, demos, videos, user fora and
shared knowledge, MATLAB based subject books....
Disclaimer and scope:
In this introduction to MATLAB, we will only be scratching the surface. Just the flavour of
matlab for understanding its usage in signals and systems lab experiments. Also nothing can
beat built-in MATLAB documentation. But we will give enough push/guidance so that the
reader can be on his own with the various help mechanisms available in MATLAB.
Versions
MATLAB has two releases every year; they are called like 2015a, 2015b, 2016a, and 2016b.
Next one is expected in Feb-Mar 2017timeframe.
Invoking MATLAB and using MATLAB as a calculator
MATLAB is easier-to-use than a calculator and yet incomparably powerful.
Let us get started! INVOKE MATLAB! By double-clicking on the MATLAB icon on your
desktop.
Let us see some examples of using MATLAB for numerical calculations – MATLAB as a
calculator.
You can erase an entire line of command, without executing by pressing the [esc] key.
You can use Up-arrow or Down-arrow keys to access previously executed commands and
execute them after making changes using the LeftArrow, RightArrow to reach the place of
correction. Any previously executed command can be reexecuted as it is – using the same
method – if no correction is needed.
ORDER OF PRECEDENCE:
MATLAB follows normal mathematical rule of operator precedence BODMAS.
() highest precedence
Mathematical constants (not comprehensive list)
pi (MATLAB is case-sensitive, so pi, Pi, pI, PI are all different, for example!)
i,j (square root of -1, as long as you did not change the value of it by assigning some other
value to it.)
>>3+5i
ans =
3.0000 + 5.0000i
All the built-in constants can be reassigned. And other variables can be created with these
values.
How to get out of a logjam?
Ctrl+C
>>a=1;while a==1,end
Ctrl+C
>>
How to get out?
Key in exit or close the MATLAB window.
1. MATLAB BASICS
In these examples, the results are stored in ‘ans’. So the latest result overwrites the previous
‘ans’.
Sl.
Arithmetic operations MATLAB Expressions
No.
01 2.7183 + 3.1416 2.7183 + 3.1416
02 1947-1857 1947-1857
03 60x60 60*60
04 25 2^5
05 25 2^5 / (2^5-1)
25 − 1
06
3*(sqrt(5)-1) / (sqrt(5)+1)^2-1
Sl.
Trigonometric functions MATLAB Expressions
No.
01 sin (π/6) sin(pi/6)
02 cos (π) cos(pi)
03 tan (π/2 tan(pi/2)
04 Sin2 π/6 + cos2 π/6 (sin(pi/6))^2 + (cos(pi/6))^2
Example:
Given a=3; b=2;c=5; d=3;
a) y = a*b+c*d
= 3*2+5*3 => 6+15 => 21 => y = 21
b) y = a*(b+c)*d
= 3*(2+5)*3 => 3*7*3 => y = 63
c) y = (a*b)+(c*d)
= (3*2)+(5*3) => 6+15 => y = 21
d) y = a^b^d;
= 3^2^3 => 9^3 => y = 729
e) y = a^(b^d)
= 3^(2^3) => 3^8 => y = 6561
Initializing with
builtin functions MATLAB
Comments
in MATLAB / Expression
OCTAVE
1. A =
Creates 2X2 with 0’s
zeros(2);
2. B =
Creates 2X3 with 0’s
zeros(2,3);
3. C =
Creates 2X3 with 1’s
ones(2,3);
Array operations:
1. .* => Element by element multiplication
2. ./ => Element by element left division
3. .\ => Element by element right division
4. .^ => Element by element exponentiation
MATRIX PROBLEMS:
1. Assume
SIMPLE X, Y PLOTS
output:
%MATLAB Code to plot both sine and cosine in one figure window
clc;
t=0:0.00001:0.01;
A=10;
f=200;
y1=A*sin(2*pi*f*t);
y2=A*cos(2*pi*f*t);
plot(t,y1,t,y2);
xlabel('time axis');
ylabel('Amplitude');
title('sine/cosine wave plot');
%MATLAB Code to plot both sine and cosine in separate figure window
clc;
t=0:0.00001:0.01;
A=10;
f=200;
y1=A*sin(2*pi*f*t);
y2=A*cos(2*pi*f*t);
figure(1);
plot(t,y1);
xlabel('time axis');
ylabel('Amplitude');
title('sine wave plot');
figure(2);
plot(t,y2);
xlabel('time axis');
ylabel('Amplitude');
title('cosine wave plot');
%MATLAB Code to plot both sine and cosine by dividing the figure window:
clc;
t=0:0.00001:0.01;
A=10;
f=200;
y1=A*sin(2*pi*f*t);
y2=A*cos(2*pi*f*t);
subplot(2,1,1);
% Divides the figure window into 2 rows, 1 column and 1st position respectively
plot(t,y1); % plots the waveform in continuous form
xlabel('time axis');
ylabel('Amplitude');
title('sine wave plot');
subplot(2,1,2);
% Divides the figure window into 2 rows, 1 column and 2nd position respectively
plot(t,y2);
xlabel('time axis');
ylabel('Amplitude');
title('cosine wave plot');
clc;
clear all;
close all;
disp('Unit Impulse Signal Generation'); % disp is used to display messages on the
command window
N = input('Enter no of samples:'); % input is used to read the values through console
n = -N : 1 : N;
x = inline('1*(n==0)');
stem(n,x(n));
xlabel('Sample');
ylabel('Amplitude');
title('Unit Impulse Signal');
Output:
Unit Impulse Signal Generation
Enter no of samples: 10
% OUTPUT ARGUMENTS
% a the output sequence name
% b position vector for output sequence plotting
% INPUT ARGUMENTS
% c delay of the impulse sequence
% d start position for plotting c
% e end position for plotting e
clc;
clear all;
close all;
Output:
Enter delay of the impulse sequence c: 3
Enter start position for plotting d: -10
Enter end position for plotting e: 10
Output:
Unit Step Signal Generation
Enter no of samples: 10
% OUTPUT ARGUMENTS
% a the output sequence name
% b position index for output sequence plotting
% INPUT ARGUMENTS
% c delay of the impulse sequence
% d start position for plotting
% e end position for plotting
clc;
clear all;
close all;
c= input(' Enter delay of the impulse sequence c: ');
d= input ('Enter start position for plotting d: ');
e= input (' Enter end position for plotting e: ');
if c<d,
error('impulse sample will not be seen within the range of positions given')
end
n= d:e;
x = inline('1*(n>=c)');
stem(n, x(c,n));
xlabel('sample position');
ylabel('sample value');
title('plot of the desired sequence');
Output:
Enter delay of the step sequence c: 3
Enter start position for plotting d: -10
Enter end position for plotting e: 10
clc;
clear all;
close all;
disp('Unit Ramp Signal Generation');
N = input('Enter no of samples: ');
n = -N : N;
r= inline ('n.*(n>=0)');
stem (n, r(n));
xlabel('Sample');
ylabel('Amplitude');
title('Unit Ramp Signal');
Output:
Unit Ramp Signal Generation
Enter no of samples: 10
Max Amplitude: 10
Output:
Enter delay of the ramp sequence: 3
Enter start position for plotting d: -10
Enter end position for plotting e: 10
% x1 first sequence
% n1 first sequence start position
% x2 second sequence
% n2 second sequence start position
% y restulting sequence
% n resulting sequence positin vector
clc;
clear all;
close all;
x1= input('Enter the first sequence: ');
n1= input('Enter the first sequence start position: ');
x2= input('Enter the second sequence: ');
n2= input('Enter the second sequence position: ');
MIN = min(n1,n2);
MAX = max (n1+length(x1)-1,n2+length(x2)-1);
n=MIN:MAX;
y1=zeros(1,length(n));
y2=y1;
a=n1(1)-MIN+1;
b=n2(1)-MIN+1;
y1(a:a+length(x1)-1)=x1;
y2(b:b+length(x2)-1)=x2;
y = y1+y2;% sequence addition, y1-y2 for sequence subtraction
disp(y);
subplot(3,1,1)
stem(n,y1)
title(' Signal x1' );
subplot(3,1,2)
stem(n,y2)
title(' Signal x2');
subplot(3,1,3)
stem(n,y)
title(' Signal y, addition of x1 and x2')
Output:
clc;
clear all;
close all;
x1= input('Enter the first sequence: ');
n1= input('Enter the first sequence start position: ');
x2= input('Enter the second sequence: ');
n2= input('Enter the second sequence position: ');
subplot(3,1,1)
stem(n,y1)
title(' Signal x1' );
subplot(3,1,2)
stem(n,y2)
title(' Signal x2');
subplot(3,1,3)
stem(n,y)
title(' Signal y, multiplication of x1 and x2')
Output:
clc;
clear all;
close all;
Output:
Signal x(n)
5
-
5
-2 -1.5 -1 -0.5 0 0.5 1 1.5 2
Delayed signal x(n-n1)
5
-
5
0 0.5 1 1.5 2 2.5 3 3.5 4
Advanced signal x(n+n2)
5
-5
-5 -4.5 -4 -3.5 -3 -2.5 -2 -1.5 -1
clc;
clear
all;
close
all;
n=-1:2;
x=[3 -1 0 -4];
subplot(2,1,1
)stem(n,x);
axis([-3 3 -5 5]);
title('Signal
x(n)');c=fliplr(x);
y=fliplr(-n);
subplot(2,1,2);
stem(y,c);
axis([-3 3 -5 5]);
title('Reflected Signal x(-n)');
CHALLENGE EXPERIMENT:
Write a general matlab program for shifting and folding operation also plot the graph for
x(n)=[1 3-4 5 3] and (i) x(-n+3) (ii)x(-n-5)
Output:
clc;
clear all;
close all;
x=[3 -1 1 -4];
power=sum(abs(x).^2)/length(x);
disp(power);
Energy=sum(abs(x).^2);
disp(Energy);
Output:
6.7500
27
Theory:
The output y[n] of a LTI (linear time invariant) system can be obtained by convolving
the input x[n] with the system’s impulse response h[n].
The convolution sum is
Algorithm:
1. Input the two sequences as x1, x2
2. Convolve both to get output y.
3. Plot the sequences.
Matlab Implementation:
Matlab recognizes index 1 to positive maximum. Index 0 is also not recognized. The timing
information for a sequence is provided by another vector, say n=-3:5; creates a vector with
values from -3 to 5 with an increment of 1.
During plotting, the time vector size and the sequence size should be the same, i.e., the number
of elements in the sequence x1 and in its time vector n1 should be the same. Similarly for x2
and y.
Matlab Program:
% CAUSAL SEQUENCES
%main part of computation
clc;
clear all;
close all;
x=input('Enter first sequence: ');
h=input('Enter second sequence: ');
y=conv(x,h);
disp('linear con of x & h is y= ');
disp(y);
subplot(3,1,2); % Divides the fig window into 3-rows, 1-Column & 2nd position
stem(h); % To display ‘h’ input in figure window
xlabel('time index n');
ylabel('amplitude ');
title('plot of h(n)');
subplot (3,1,3); % Divides the fig window into 3-rows, 1-Column & 3rd position
stem(y); % To display ‘y’ output in figure window
xlabel('time index n');
ylabel('amplitude ');
title('convolution output');
Calculations:-
h(n)= Impulse response of a system due to impulse input function.
y(n)= x(n) * h(n)
Using convolution property of the two delayed unit impulse sequence we get,
x(n)*h(n) = δ(n)+2δ(n-1) +3δ(n-2) + 4δ(n-3)
+2δ(n-1) + 4δ(n-2) + 6δ(n-3) + 8δ(n-4)
+3δ(n-2) + 6δ(n-3) + 9δ(n-4) +12δ(n-5)
x(n)*h(n) = δ(n) + 4δ(n-1) +10δ(n-2) +16δ(n-3) +17δ(n-4) +12δ(n-5)
Output :
Matlab Program:
% Two sided sequences (Non- Causal Sequences)
% Main part of computation
ny=[ybegin:yend];
y=conv(x,h);
disp('linear con of x & h is y=');
disp(y); % Displays the value of ‘y’ on Terminal window
subplot(3,1,2); % Divides the fig window into 3-rows, 1-Column & 2nd position
stem(n2,h);
xlabel('time index n');
ylabel('amplitude ');
title('plot of h(n)');
subplot (3,1,3); % Divides the fig window into 3-rows , 1-Column & 3rd position
stem(ny,y);
xlabel('time index n');
ylabel('amplitude ');
title('convolution output');
Calculations:-
x = [3 11 7 0 -1 4 2] h = [2 3 0 -5 2 1]
↑ ↑
x*h = [ 3δ(n+3)+11δ(n+2)+7δ(n+1)-1δ(n-1)+4δ(n-2)+2δ(n-3)]*[ 2 δ(n+1)+3 δ(n)-5 δ(n-2)+2δ(n-3)+δ(n- 4)]
CHALLENGE EXPERIMENT:
3. Write a general matlab program for linear convolution for any two general sequences
(causal and non-causal) without using inbuilt function.
A frequency response function obtained by applying DFT on the impulse response h[n]
(or by replacing z with ejΩ in H(z)) to get
Given the difference equation or H(z), the impulse response of the LTI system is found
using filter or impz matlab/gnu-octave functions. If the difference equation contains
past samples of output, i.e., y[n-1], y[n-2], etc , then its impulse response is of infinite
duration (IIR). For such systems the impulse response is computed for a large value of
n, say n=100 (to approximate n=∞).
Given only the input sequence x[n] and the output sequence y[n], we can find the
impulse function h[n] by using the inverse operation deconv. (The conv operation
convolves 2 sequences x[n] and h[n] to obtain the output y[n]. If both y[n] and x[n] are
finite then the impulse response is finite (FIR).
The de-convolution operation is valid only if the LTI system is ‘invertible’.
Matlab Implementation:
FILTER One-dimensional digital filter.
Y = FILTER(B,A,X) filters the data in vector X with the filter described by vectors A
and B to create the filtered data Y. The filter is a "Direct Form II Transposed"
implementation of the standard difference equation:
a(1)*y(n) = b(1)*x(n) + b(2)*x(n-1) + ... + b(nb+1)*x(n-nb)
- a(2)*y(n-1) - ... - a(na+1)*y(n-na)
If a(1) is not equal to 1, FILTER normalizes the filter coefficients by a(1).
% matlab program to find Impulse Response given the difference equation with zero initial
condition:
clc;
N=5;
b= [1 0.5]; % numerator coefficients
a=[1 -0.63 0.72]; % denominator coefficients
x=[1,zeros(1,N-1)]; % x=[1 0 0 0 0];
y=filter (b,a,x);
stem(y);
title('impluse response of the system without initial conditions');
Calculations:-
y[n]-0.63y[n-1]+0.72y[n-2] = x[n]+0.5x[n-1]
y[n] = 0.63y[n-1]-0.72y[n-2]+ x[n]+0.5x[n-1]
n=0; y[0] = 0.63y[0-1]-0.72y[0-2]+x[0]+0.5x[0-1]
y[0] = 1
= (0.63)(1)+(0.5)(1)
y[1] = 1.13
= (0.63)(1.13)-(0.72)(1)
y[2] = -0.008100
= (0.63)(-0.008100)-(0.72)(1.13)
y[3] = -0.818703
n=4; y[4] = 0.63y[4-1]-0.72y[4-2]+x[4]+0.5x[4-1]
= (0.63)(-0. 8187)-(0.72)(-0.0081)
y[4] = -0.509949
Result:
the impluse response of the system
without initial conditions 1.0000 1.1300
-0.0081 -0.8187 -0.5100
FOURIER SERIES
A Fourier series is an expansion of a periodic function f(x) in terms of an infinite
sum of sines and cosines. Fourier series make use of the orthogonally
relationships of the sine and cosine functions. The computation and study of
Fourier series is known as harmonic analysis and is extremely useful as a way to
break up an arbitrary periodic function into a set of simple terms that can be
plugged in, solved individually, and then recombined to obtain the solution to the
original problem or an approximation to it to whatever accuracy is desired or
practical. Examples of successive approximations to common functions using
Fourier series are illustrated above.
In particular, since the superposition principle holds for solutions of a linear
homogeneous ordinary differential equation, if such an equation can be solved in
the case of a single sinusoid, the solution for an arbitrary function is immediately
available by expressing the original function as a Fourier series and then plugging
in the solution for each sinusoidal component. In some special cases where the
Fourier series can be summed in closed form, this technique can even yield
analytic solutions.
Any set of functions that form a complete orthogonal system have a
corresponding generalized Fourier series analogous to the Fourier series. For
example, using orthogonally of the roots of a Bessel function of the first kind
gives a so-called Fourier-Bessel series.
The computation of the (usual) Fourier series is based on the integral identities
Using the method for a generalized Fourier series, the usual Fourier series
Signals and Systems Lab Manual - B20EN0502 Sem:V P a g e | 39
REVA University School of ECE
involving sines and cosines is obtained by taking f1(x)=cosx and f2(x)=sinx. Since
these functions form a complete orthogonal system over [-pi,pi], the Fourier series
of a function f(x) is given by
and n=1, 2, 3, .... Note that the coefficient of the constant term has been written
in a special form compared to the general form for a generalized Fourier series in
order to preserve symmetry with the definitions of an and bn
The Fourier series for a few common functions are summarized in the table below.
% matlab program to find Impulse Response given the difference equation with initial
condition:
clc;
N=5;
b= [1 0.5]; % numerator coefficients
a=[1 -0.63 0.72]; % denominator coefficients
x=[1,zeros(1,N-1)]; % x=[1 0 0 0 0];
zi=filtic(b,a,[1 2]); % with initial conditions y(-1) = 1 and y(-2) = 2
y=filter (b,a,x,zi);
disp('the impluse response of the system with initial conditions');
disp(y);
stem(y);
title('impluse response of the system with initial conditions');
Calculations:-
y[n]-0.63y[n-1]+0.72y[n-2] = x[n]+0.5x[n-1]
y[n] = 0.63y[n-1]-0.72y[n-2]+ x[n]+0.5x[n-1]
Result:
the impluse response of the system with initial conditions
0.1900 -0.1003 -0.2000 -0.0538 0.1101
CHALLENGE EXPERIMENT:
1. Write a matlab program to extend the calculation of output for other standard inputs
like unit step, ramp and sinusoid (can use matlab inbuilt functions).
clear all;
close all;
tfinal=0.05;
t=0:0.00005:tfinal;
xt=cos(2*pi*f1*t)+cos(2*pi*f2*t);
fm=max(f1,f2);
fs=1.3*fm;
Ts=1/fs;
n=0:Ts:tfinal;
xn=cos(2*pi*f1*n)+cos(2*pi*f2*n);
figure(1)
subplot(3,1,1);
plot(t,xt)
xlabel('t')
ylabel('x(t)')
subplot(3,1,2);
stem(n,xn)
xlabel('n')
ylabel('x(n)')
subplot(3,1,3);
plot(t,xt,'b',n,xn,'r*-');
xlabel('t')
fs=2*fm;
Ts=1/fs;
n=0:Ts:tfinal;
xn=cos(2*pi*f1*n)+cos(2*pi*f2*n);
figure(2)
subplot(3,1,1);
plot(t,xt)
xlabel('t')
ylabel('x(t)')
subplot(3,1,2);
stem(n,xn)
xlabel('n')
ylabel('x(n)')
subplot(3,1,3);
plot(t,xt,'b',n,xn,'r*-');
xlabel('t')
fs=5*fm;
Ts=1/fs;
n=0:Ts:tfinal;
xn=cos(2*pi*f1*n)+cos(2*pi*f2*n);
figure(3)
subplot(3,1,1);
plot(t,xt)
xlabel('t')
ylabel('x(t)')
subplot(3,1,2);
stem(n,xn)
xlabel('n')
ylabel('x(n)')
subplot(3,1,3);
plot(t,xt,'b',n,xn,'r*-');
xlabel('t')
Output:
TMS320C6713 DSK
The C6713 DSK has a TMS320C6713 DSP onboard that allows full-speed verification of code
with Code Composer Studio. The C6713 DSK provides:
A USB Interface
SDRAM and ROM
An analog interface circuit for Data conversion (AIC)
An I/O port
Embedded JTAG emulation support
Connectors on the C6713 DSK provide DSP external memory interface (EMIF) and peripheral
signals that enable its functionality to be expanded with custom or third party daughter boards.
The DSK provides a C6713 hardware reference design that can assist you in the development
of your own C6713-based products. In addition to providing a reference for interfacing the
DSP to various types of memories and peripherals, the design also addresses power, clock,
JTAG, and parallel peripheral interfaces.
The C6713 DSK includes a stereo codec. This analog interface circuit (AIC) has the following
characteristics:
The DSK includes 4 LEDs and 4 DIP switches as a simple way to provide the user with
interactive feedback. Both are accessed by reading and writing to the CPLD registers.
An included 5V external power supply is used to power the board. On-board voltage regulators
provide the 1.26V DSP core voltage, 3.3V digital and 3.3V analog voltages. A voltage
supervisor monitors the internally generated voltage, and will hold the board in reset until the
supplies are within operating specifications and the reset button is released. If desired, JP1 and
JP2 can be used as power test points for the core and I/O power supplies.
Code Composer communicates with the DSK through an embedded JTAG emulator with a
USB host interface. The DSK can also be used with an external emulator through the external
JTAG connector.
3. You will get workspace Launcher window in workspace select the drive other than
‘C’ and create a new folder by your SRN and click OK.
4. Click on project and select New CCS Project in that select the desired properties as
given in the picture and click on Finish button.
NOTE:
For real time programs select hello.cmd file and for non-real programs select C6713.cmd
5. Once you click on finish button you will get a CCS editor window, in that type the C
program and at the end click on SAVE button.
6. To rename the file name instead of main.c Right click on main.c which is in project
explorer window and select Rename icon or press F2 button.
7. You will get a new Rename Resource window there you give a new file name with
extension ‘.C’ and click ‘OK’.
8. Now to build the project click on HAMMER symbol which is on the top left
of editor window.
Note:
If any error occurs in the program that will be displayed in the console window which is at
the bottom of editor window. Clear that error again click on save button and repeat the same
above step.
9. After building the project to debug the program click on BUG symbol which is
on the top left of editor window.
10. Now to RUN the program click on Resume or F8 button which is on the top left
of editor window.
11. In the console window you can observe the output values.
For the very first time after installation of CCS software the following properties has to be
modified.
#include <stdio.h>
#include<math.h>
for(i=0;i<127;i++)
{
m[i]=sin(2*3.14*FREQ*i/24000);
printf("%f\n",m[i]);
}
}
NOTE:
Procedure is given in page number 48 to run code composer studio v6.1.3. Follow the steps.
main()
{
int m=3; /*Length of i/p samples sequence*/
int n=4; /*Length of impulse response Co-efficient */
int i=0,j;
int x[15]={1,2,3,4,0,0,0,0,0,0}; /*Input Signal Samples*/
int h[15]={1,2,3,0,0,0,0,0,0}; /*Impulse Response Co-efficient*/
for(i=0;i<m+n-1;i++)
{
y[i]=0;
for(j=0;j<=i;j++)
y[i]+=x[j]*h[i-j];
}
for(i=0;i<m+n-1;i++)
printf("%d\n",y[i]);
}
Calculations:
x[n] = [1 2 3 4]—> L1=4 h[n] = [1 2 3]—> L2=3
L=L1+L2-1 => 4+3-1=>6 L=6
y[n]=x[n].h[n]
∞
y[n]= Σ x[n].h[n]
-∞
Now,
5
y[n]= Σ x[n].h[n]
K=0
5
n=0, y[0] = Σ x[k].h[0-k]
K=0
y[0] = 1
5
n=1, y[1] = Σ x[0].h[1-k]
K=0
=>(1)(2)+(2)(1) =>2+2
y[1] = 4
5
n=2, y[2] = Σ x[0].h[2-k]
K=0
5
n=3, y[3] = Σ x[0].h[3-k]
K=0
5
n=4, y[4] = Σ x[0].h[4-k]
K=0
5
n=5, y[5] = Σ x[0].h[5-k]
K=0
=>(4)(3) =>12
y[5]= 12
y[n] = [1 4 10 16 17 12]
NOTE:
Procedure is given in page number 48 to run code composer stu dio v6.1.3.
Follow the steps.
Follow us on
/REVAUniversity