Signals and Systems Lab Manual Print
Signals and Systems Lab Manual Print
LIST OF EXPERIMENTS
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
EXPERIMENT NO.:-1
OBJECTIVE: - Write a Matlab code to generate different types of basic Signals.
HARDWARE /SOFTWARE REQUIRED:1) MATLAB 7.6 Version
2) Computer
3) Printer
Theory:Basic idea of different types of basic signals i.e.
i.
Unit impulse function
0;t0
IV exponential function
0 ; t<0
There can be different cases in which a value differences.
a can be real
(i) real (ii) negative
a can be a purely imaginary
a can be complex with both real and imaginary part.
Program Code:
t = -20:20;
t1 = -5:0.01:5;
t2 = -5:5;
unit_imp = [zeros(1,20),1,zeros(1,20)];
unit_step = [zeros(1,20),ones(1,21)];
i=1;
for k=-20:20
if k>0
ramp(i) = k;
else
ramp(i) = 0;
end
i = i+1;
end
expo = exp(-t2);
sinu = sin(t1);
subplot(3,2,1);
stem(t,unit_imp);
SIGNALS AND SYSTEMS LABORATORY EC-209
xlabel('Time');
ylabel('Unit Impulse signal');
grid on;
subplot(3,2,2);
stem(t,unit_step);
xlabel('Time');
ylabel('Unit Step signal');
grid on;
subplot(3,2,3);
stem(t,ramp);
xlabel('Time');
ylabel('Ramp signal');
grid on;
subplot(3,2,4);
stem(t2,expo);
xlabel('Time');
ylabel('Exponential signal')
grid on;
Observation/Plot
EXPERIMENT NO.:-2
OBJECTIVE:-Write a Matlab code to perform arithmetic operations for a signal such as
addition, subtraction, multiplication and division.
HARDWARE/SOFTWARE REQUIRED:1) MATLAB version7.6
2) Computer
3) Printer
Theory:- The theoretical results of various arithmetic operations such as addition,
multiplications, subtraction of two signals (say sine wave and ramp signal).
Let us consider two signals
x(t)=sin(wt)
y(t)-cos(wt)
Signal processing operation on dependent variable is of the following types:1) Addition
z(t)=x(t)+y(t)
=sin(wt)+cos(wt)
2)Subtraction
z(t) =x(t)-y(t)
=sin(wt)-cos(wt)
3) Multiplication
z(t)=x(t)*y(t)
=sin(wt)*cos(wt)
4) Division
z(t)=x(t)/y(t);y(t)0
=sin(wt)/cos(wt)
Program Code:
t = -5:0.1:5;
x = sin(t);
y= cos(t);
x_addition = x+y;
x_division = x./y;
x_multiplication = x.*y;
x_subtraction = x-y;
grid on;
subplot(2,3,1);
plot(t,x);
grid on;
xlabel('Time');
ylabel('Original Signal');
subplot(2,3,2);
plot(t,x_addition);
SIGNALS AND SYSTEMS LABORATORY EC-209
grid on;
xlabel('Time');
ylabel('Added Signal');
subplot(2,3,3);
plot(t,x_division);
grid on;
xlabel('Time');
ylabel('Divided Signal');
subplot(2,3,4);
plot(t,x_multiplication);
grid on;
xlabel('Time');
ylabel('Multiplied Signal');
subplot(2,3,5);
plot(t,x_subtraction);
grid on;
xlabel('Time');
ylabel('subtracted Signal');
Observation/Plot
EXPERIMENT NO.:-3
OBJECTIVE: -Write a MATLAB code to perform signal processing operations time scaling
time shifting time inversion.
Hardware/Software required:1) MATLAB version7.6
2) Computer
3) Printer
Theory:Various signal processing operation that can be performed on a signal are:x(t)=
Time inversion: -if x (t) is the original signal then x (-t) is the time inverted signal.
-3
0
Time scaling: - if x (t) is a given signal then x(t) is time scaled by a is given below;
0
1
Time shifting:- if x(t) is a given signal then x(t) is time shifted by t 0 can be obtained
Delayed x(t-t0 )
t0
3-to
Advanced x(t+t0)
t0+2
Observation/Plot
Experiment NO.:-4
OBJECTIVE:- Write a program to find the Convolution of two signals.
Hardware/Software required:1) MATLAB version 7.6
2) Computer
3) Printer
Theory:The below equation defines the integral convolution of 2 time signals x (t) and h (t) denoted by
Or
Program Code:
a=[1 2 3];
b=[4 5 6];
i=length(a);
j=length(b);
A=[a,zeros(1,i)];
B=[b,zeros(1,j)];
for k=1:i+j-1
y(k)=0;
for l=1:i
if (k-l+1>0)
y(k)=y(k)+A(l)*B(k-l+1);
else
end
end
end;
stem (y);
ylabel('Y[k]');
xlabel('----->n');
title('convolution of two signals');
Observation/Plot
Experiment NO.:-5
OBJECTIVE:-Write a matlab code to determine the LTI response of a given Input signal.
Hardware/Software required:1) Matlab version 7.6
2) Computer
3) Printer
Theory: - LTI system or linear time invariant system
LTI response of the signal y(t)
end
end
y(p) = sum;
end
t1 = 0:0.01:(Ly-1)*0.01;
%Input Signal
subplot(2,2,1);
plot(t,x);
title('Input Signal');
xlabel('Time'); ylabel('Amplitude of the signal');
%Impulse Response
subplot(2,2,2);
plot(t,h);
title('Impulse Response');
xlabel('Time'); ylabel('Amplitude of the signal');
%Output of the LTI System
subplot(2,2,[3:4]);
plot(t1,y);
title('Output of the LTI System');
xlabel('Time'); ylabel('Amplitude of the signal');
Observation/Plot
Experiment No:-6
OBJECTIVE:- Write a matlab code to generate Fourier transform of a given Input signal and
plot its Magnitude and Phase spectra.
Hardware required/software required:1) MATLAB version 7.6
2) Computer
3) Printer
Theory:-Fourier transform is divided into 2 parts
Continuous time Fourier transform
This is applicable for aperiodic function and periodic functions
subplot(2,2,2);
plot(magx);
grid;
xlabel('n');
ylabel('Magnitude');
title('Magnitude plot');
subplot(2,2,3);
plot(phase);
grid;
xlabel('n');
ylabel('degrees');
title('Phase plot')
Observation/Plot
Experiment No:-7
OBJECTIVE: - Write a matlab code to generate frequency spectrum of a periodic signal.
Hardware/Software required:1) MATLAB version 7.6
2) Computer
3) Printer
Theory:-A continuous time signal x(t) to be periodic if there is a positive non zero value of t for
which
All
----- (1)
The fundamental period T0 of x (t) is the smallest positive value of T for which equation (1) is
not satisfied and 1/t0=f0 is referred as fundamental frequency.
Two basic example of periodic signal are the real sinusoidal signal
The complex exponential Fourier series representation of a periodic signal x(t) with To as
fundamental period
wo=2/To
Where
Observation/Plot
Experiment No.: 8
OBJECTIVE:-Write a matlab code to generate inverse Fourier transform of a signal.
Hardware/Software Requirements:
1) MATLAB version 7.6
2) Computer/Laptop
2) Printer
Theory:- Inverse Fourier transform is used to convert a signal in frequency domain to a signal in
time domain.
If X(w) is the Fourier transform of a signal then, the original signal x(t) or inverse Fourier
transform of X(w) is given by:-
In MATLAB, we can use a direct command to evaluate the inverse Fourier transform i.e.
d=ifft(x);
Program Code: (Example)
w=-100:.1:100;
X = 1./(1+w.^2)
dw = 0.1;
m=1;
for t=0:0.01:10
i=1;
sum=0;
for w=-100:dw:100
sum = sum + X(i)*exp(j*w*t)*dw;
i=i+1;
end
x(m) = sum;
m=m+1;
end
w=-100:.1:100;
t=0:.01:10;
%given signal
subplot(2,1,1);
plot(w,X);
title('Given signal in Frequency domain');
xlabel('Frequency \rightarrow');
ylabel('X(w)');
grid on;
%signal in time domain
subplot(2,1,2);
SIGNALS AND SYSTEMS LABORATORY EC-209
plot(t,x);
title('Signal obtained via Inverse FT');
xlabel('Time \rightarrow');
ylabel('x(t)');
grid on;
Observation/Plot
Experiment No.:-9
OBJECTIVE:-Write a Matlab code to perform and plot the Frequency response and Phase
response of FIR system.
Hardware/Software Required:1) MATLAB version 7.6
2) Computer
3) Printer
Theory:- [h,p]=-freqz(ba,a,w) returns the frequency response vector h and the corresponding
angular frequency vector for the digital filter whose transfer function is determined by the (real
or complex) numerator and denominator polynomial represented by the vector b and a
respectively. The vector h and p are both of length w has values ranging from 0 to pi per sample.
ylabel('<H[w]');
Observation/Plot
Experiment No.:-10
OBJECTIVE:-Write a Matlab code to perform and plot the frequency response and phase
response of IIR system.
Hardware/Software Required:1) MATLAB version 7.6
2) Computer
3) Printer
Theory:- a system whose impulse response or no. of non zero values of the output is infinite is
called infinite impulse response IIR system.
Let x (t) be the input signal. Let h(t) be the impulse response &Let y(t) be the response of the
system.
Taking Fourier transform, of the three. We get X (w), Y(w) &h(w)
Y (t)=x(t)*h(t)
Taking Fourier transform
Y(w)=X(w)H(w)
H (w)=Y(w)/X(w)
H (w) is called frequency response of system.
Program Code: (Example)
h1=(0.5)^n;
a=[1,-0.5];
b=[1];
w=-pi:.01:pi;
[h,p]=freqz(b,a,h);
% plot of the magnitude of frequency response of the system
subplot(2,1,1)
plot(w,h);
grid on;
title('plot of the magnitude response ');
xlabel('w');
ylabel('|H[w]|');
% plot of the phase of frequency response of the system
subplot(2,1,2)
plot(p);
grid on;
title('Phase response ');
xlabel('w');
ylabel('<H[w]');
Observation/Plot
SIGNALS AND SYSTEMS LABORATORY EC-209
Experiment No.:-11
OBJECTIVE:-Write a Matlab code to plot poles &zeros of the given Z transform of signal.
Hardware/Software Required:1) MATLAB version 7.6
2) Computer
3) Printer
THEORY:- A pole-zero plot shows the location in the complex plane of the poles and zeros of
the transfer function of a dynamic system, such as a controller, compensator, sensor, equalizer,
filter, or communications channel. By convention, the poles of the system are indicated in the
plot by an X while the zeroes are indicated by a circle or O.A pole-zero plot can represent either
a continuous-time (CT) or a discrete-time (DT) system. For a CT system, the plane in which the
poles and zeros appear is the s plane of the Laplace transform. In this context, the
parameter s represents the complex angular frequency, which is the domain of the CT transfer
function. For a DT system, the plane is the z plane, where z represents the domain of the Ztransform. This function displays the poles and zeros of discrete-time systems.
zplane(b,a) where b and a are row vectors, first uses roots to find the zeros and poles of the
transfer function represented by numerator coefficients b and denominator coefficients a. The
transfer function is defined in terms of z-1:
Zplane (b,a) plots the zeros specified in column vector b and the poles specified in column vector
a in the current figure window. The symbol 'o' represents a zero and the symbol 'x' represents a
pole. The plot includes the unit circle for reference. If z and p are arrays, zplane plots the poles
and zeros in the columns of z and p in different colors.
Program Code: (Example)
b= [1 0 0 -8];
a= [1 0 -1];
Zplane (b, a);
Observation/Plot