SlideShare une entreprise Scribd logo
1  sur  58
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 1
Babaria Institute of Technology
Electrical Engineering Department
Semester :4 Branch:EE
Subject: Signals & Systems (2141005) Experiment No. 1
Aim: To familiarize with MATLAB software, general functions and signal processing
toolbox functions.
The name MATLAB stands for MATrix LABoratory produced by Mathworks Inc., USA. It is a
matrix-based powerful software package for scientific and engineering computation and
visualization. Complex numerical problems can be solved in a fraction of the time that
required with other high level languages. It provides an interactive environment with
hundreds of built -in –functions for technical computation, graphics and animation. In
addition to built-in-functions, user can create his own functions.
MATLAB offers several optional toolboxes, such as signal processing, control systems, neural
networks etc. It is command driven software and has online help facility.
MATLAB has three basic windows normally; command window, graphics window and edit
window.
Command window is characterized by the prompt ‘>>’.
All commands and the ready to run program filename can be typed here. Graphic window
gives the display of the figures as the result of the program. Edit window is to create
program files with an extension .m.
Some important commands in MATLAB
Help : List topics on which help is available
Help command name: Provides help on the topic selected
Demo : Runs the demo program
Who : Lists variables currently in the workspace
Whos : Lists variables currently in the workspace with their size
Clear : Clears the workspace, all the variables are removed
Clear x,y,z : Clears only variables x,y,z
Quit: Quits MATLAB
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 2
Some of the frequently used built-in-functions in Signal Processing Toolbox
filter(b.a.x): Syntax of this function is Y = filter(b.a.x)
It filters the data in vector x with the filter described by vectors
a and b to create the filtered data y.
fft (x): It is the DFT of vector x
ifft (x) : It is the DFT of vector x
conv (a,b) : Syntax of this function is C = conv (a,b)
It convolves vectors a and b. The resulting vector is ofLength,
Length (a) + Length (b)-1
deconv(b,a): Syntax of this function is [q,r] = deconv(b,a)
It deconvolves vector q and the remainder in vector r such that
b = conv(a,q)+r
butter(N,Wn): Designs an Nth order lowpass digital Butterworth filter and
returns the filter coefficients in length N+1 vectors B
(numerator) and A (denominator). The coefficients are listed in
descending powers of z. The cutoff frequency Wn must be 0.0
< Wn < 1.0, with 1.0 corresponding tohalf the sample rate.
buttord(Wp, Ws, Rp, Rs): Returns the order N of the lowest order digital Butterworth
filter that loses no more than Rp dB in the passband and has at
least Rs dB of attenuation in the stopband. Wp and Ws are the
passband and stopband edge frequencies, Normalized from 0
to 1 ,(where 1 corresponds to pi rad/sec)
Cheby1(N,R,Wn) : Designs an Nth order lowpass digital Chebyshev filter with R
decibels of peak-to-peak ripple in the passband. CHEBY1
returns the filter coefficients in length N+1 vectors B
(numerator) and A (denominator). The cutoff frequency Wn
must be 0.0 < Wn < 1.0, with 1.0 corresponding to half the
sample rate.
Cheby1(N,R,Wn,'high'): Designs a highpass filter.
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 3
Cheb1ord(Wp, Ws, Rp, Rs): Returns the order N of the lowest order digital Chebyshev
Type I filter that loses no more than Rp dBin the passband and
has at least Rs dB of attenuation in the stopband. Wp and Ws
are the passband and stopband edge frequencies, normalized
from 0 to 1 (where 1 corresponds to pi radians/sample)
cheby2(N,R,Wn) : Designs an Nth order lowpass digital Chebyshev filter with the
stopband ripple R decibels down and stopband edge
frequency Wn. CHEBY2 returns the filter coefficients in length
N+1 vectors B (numerator) and A. The cutoff frequency Wn
must be 0.0 < Wn < 1.0, with 1.0 corresponding to half the
sample rate.
cheb2ord(Wp, Ws, Rp, Rs): Returns the order N of the lowest order digital Chebyshev
Type II filter that loses no more than Rp dB in the passband
and has at least Rs dB of attenuation in the stopband. Wp and
Ws are the passband and stopband edge frequencies.
abs(x): It gives the absolute value of the elements of x. When x is
complex, abs(x) is the complex modulus (magnitude) of the
elements of x.
angle(H): It returns the phase angles of a matrix with complex elements
in
radians.
freqz(b,a,N) : Syntax of this function is [h,w] = freqz(b,a,N) returns the
Npoint
frequency vector w in radians and the N-point complex
frequency response vector h of the filter b/a.
stem(y) : It plots the data sequence y aa stems from the x axis
terminated
with circles for the data value.
stem(x,y): It plots the data sequence y at the values specified in x.
ploy(x,y) : It plots vector y versus vector x. If x or y is a matrix, then the
vector is plotted versus the rows or columns of the
matrix,cwhichever line up.
title(‘text’): It adds text at the top of the current axis.
xlabel(‘text’): It adds text beside the x-axis on the current axis.
ylabel(‘text’): It adds text beside the y-axis on the current axis.
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 4
Experiment :2
To plot graph of Continuous Time Signals
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 5
Unit step function
Program :
T=30;
x=ones(1,T);
t=0:1:T-1
plot(t,x);
grid on;
xlabel('time(sec)')
ylabel('x(t)')
Output :
0 5 10 15 20 25 30
0
0.5
1
1.5
2
time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 6
Unit ramp function
Program :
t=0:0.03:4;
x=t;
plot(t,x)
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
0 1 2 3 4
0
1
2
3
4
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 7
Unit parabolic function
Program :
t=0:0.01:2;
x=t.^2/2;
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
0 0.5 1 1.5 2
0
0.5
1
1.5
2
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 8
Impulse function
Program :
for t = 0;
x = 1;
end;
plot(t,x);
stem(t,x)
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
-1 -0.5 0 0.5 1
0
0.2
0.4
0.6
0.8
1
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 9
Rectangular pulse function
Program :
t=-1:0.001:1;
x=rectpuls(t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
-1 -0.5 0 0.5 1
0
0.2
0.4
0.6
0.8
1
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 10
Triangular pulse function
Program :
t=-1:0.002:1;
x=tripuls(t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output:
Signum function
-1 -0.5 0 0.5 1
0
0.2
0.4
0.6
0.8
1
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 11
Program :
t=-10:0.001:10;
x=sign(t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output:
-10 -5 0 5 10
-1
-0.5
0
0.5
1
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 12
Sinc function
Program :
t =-4:0.05:4;
x=sinc(t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output:
-4 -2 0 2 4
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 13
Gaussian function
Program :
t=-5:0.03:5;
a=1;
x=exp(-a*t.^2);
plot(t,x)
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
-5 0 5
0
0.2
0.4
0.6
0.8
1
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 14
Sinusoidal signal
Program :
t=0:0.01:2;
x=2*sin(pi*t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
0 0.5 1 1.5 2
-2
-1
0
1
2
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 15
Real exponential signals
Program :
t=0:0.04:4;
x=2*exp(1*t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output : 1. a>0
0 1 2 3 4
0
10
20
30
40
50
60
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 16
Program :
t=0:0.04:4;
x=2*exp(-1*t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output : 2. a<0
Program :
0 1 2 3 4
0
0.2
0.4
0.6
0.8
1
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 17
t=0:0.04:4;
x=2*exp(0*t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output : 3. a=0
0 1 2 3 4
-1
-0.5
0
0.5
1
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 18
Complex exponential function
Program :
t=-10:0.001:10;
c=complex(0,1);
x=exp(c*t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
-10 -5 0 5 10
-1
-0.5
0
0.5
1
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 19
Program :
t=-10:0.001:10;
c=complex(-1,12);
x=exp(c*t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
-10 -5 0 5 10
-2
-1
0
1
2
3
x 10
4
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 20
Program :
t=-10:0.001:10;
c=complex(1,12);
x=exp(c*t);
plot(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
-10 -5 0 5 10
-2
-1
0
1
2
3
x 10
4
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 21
Experiment :3
To plot graph of Discrete Time Signals
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 22
Unit step sequence
Program :
T=30;
x=ones(1,T);
t=0:1:T-1
stem(t,x);
grid on;
xlabel('time(sec)')
ylabel('x(t)')
Output :
0 5 10 15 20 25 30
0
0.2
0.4
0.6
0.8
1
time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 23
Unit ramp sequence
Program :
t=0:0.5:4;
x=t;
stem(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
0 1 2 3 4
0
1
2
3
4
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 24
Unit impulse sequence
Program :
for t = 0;
x = 1;
end;
plot(t,x);
stem(t,x)
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
-1 -0.5 0 0.5 1
0
0.2
0.4
0.6
0.8
1
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 25
Exponential sequence
Program :
t=0:0.35:4;
x=2.^t;
stem(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
0 1 2 3 4
0
10
20
30
40
50
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 26
Program :
t=0:0.35:4;
x=0.2.^t;
stem(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
0 1 2 3 4
0
0.2
0.4
0.6
0.8
1
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 27
Program :
t=0:0.35:4;
x=-0.2.^t;
stem(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
0 1 2 3 4
-1
-0.8
-0.6
-0.4
-0.2
0
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 28
Program :
t=0:0.35:4;
x=-2.^t;
stem(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
0 1 2 3 4
-15
-10
-5
0
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 29
Sinusoidal sequence
Program :
t=0:0.1:2;
x=2*sin(pi*t);
stem(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
0 0.5 1 1.5 2
-2
-1
0
1
2
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 30
Complex exponential sequence
Program :
t=-10:0.3:10;
c=complex(0.3,4);
x=exp(c*t);
stem(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
-10 -5 0 5 10
-15
-10
-5
0
5
10
15
20
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 31
Program :
t=-10:0.3:10;
c=complex(0.3,4);
x=exp(c*t);
stem(t,x);
grid on;
xlabel('Time(sec)')
ylabel('x(t)')
Output :
-10 -5 0 5 10
-15
-10
-5
0
5
10
15
20
Time(sec)
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 32
Experiment :04
To perform signal operation using
stimulink
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 33
Program : u(t)-u(t-1)
Output :
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 34
Program : r(t)-2r(t-1)+r(t-2)
Output :
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 35
Program : r(t)-2u(t-1)-r(t-2)
Output :
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 36
Program : r(t)-r(t-1)-u(t-1)
Output :
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 37
Experiment :05
To perform the convolution sum
of discrete time signal.
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 38
Program :
a=[ 1 -1 2 3];
b=[ 1 -2 3 -1];
z=conv(a,b);
m=length(z);
y=0:m-1;
stem(y,z);
Output :
0 1 2 3 4 5 6
-5
0
5
10
a
b
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 39
Program :
a=[ 1 2 3 2];
b=[ 1 2 2];
z=conv(a,b);
m=length(z);
y=0:m-1;
stem(y,z);
Output :
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
0
5
10
15
a
b
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 40
Program :
a=[ 1 4 3 2];
b=[ 1 3 2 1];
z=conv(a,b);
m=length(z);
y=0:m-1;
stem(y,z);
Output :
0 1 2 3 4 5 6
0
5
10
15
20
a
b
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 41
Program:
a=[ 1 -2 3 1];
b=[ 2 -3 -2];
z=conv(a,b);
m=length(z);
y=0:m-1;
stem(y,z);
Output:
0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5
-10
-5
0
5
10
a
b
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 42
Experiment :06
To perform z-transform using
MATLAB
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 43
Program :
syms f n;
f=2^n;
ztrans(f);
Output :
z/(z - 2)
Program :
syms f n w;
f=cos(n);
ztrans(f);
Output :
(z*(z - cos(1)))/(z^2 - 2*cos(1)*z + 1)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 44
Program :
syms f n w;
f=2^n+3^n;
ztrans(f);
Output :
z/(z - 2) + z/(z - 3)
Program :
syms f n w;
f=(n^2)*(2^n);
ztrans(f);
Output :
(z^2/4 + z/2)/(z/2 - 1)^3
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 45
Experiment :07
To plot zeros and poles in the z-plane
using MATLAB.
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 46
Program :
syms n d z
n=[1 1];
d=[1 2 3 4];
sys=tf(n,d),disp(z);
zplane(n,d);
Output :
s + 1
s^3 + 2 s^2 + 3 s + 4
-2 -1.5 -1 -0.5 0 0.5 1 1.5
-1.5
-1
-0.5
0
0.5
1
1.5
2
Real Part
ImaginaryPart
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 47
Program :
syms n d z
n=[1 0.5];
d=[1 1 1];
sys=tf(n,d),disp(z);
zplane(n,d);
Output :
s + 0.5
s^2 + s + 1
-1.5 -1 -0.5 0 0.5 1 1.5
-1
-0.5
0
0.5
1
Real Part
ImaginaryPart
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 48
Program :
syms n d z
n=[3 0];
d=[1 6 9];
sys=tf(n,d),disp(z);
zplane(n,d);
Output :
3 s
s^2 + 6 s + 9
-3 -2 -1 0 1
-1
-0.5
0
0.5
1
22
Real Part
ImaginaryPart
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 49
Program :
syms n d z
n=[1 1 0];
d=[1 3 1 1];
sys=tf(n,d),disp(z);
zplane(n,d);
Output :
s^2 + s
s^3 + 3 s^2 + s + 1
-2.5 -2 -1.5 -1 -0.5 0 0.5 1
-1
-0.5
0
0.5
1
2
Real Part
ImaginaryPart
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 50
Experiment -08
To perform FFT using MATLAB.
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 51
1. Program:
a = input('enter sequence');
b = length(a);
x = fft(a,b)
Output:
Enter sequence[1 2 3 4]
x =
10.0000 -2.0000 + 2.0000i -2.0000 -2.0000 - 2.0000i
2. Program :
a = input('enter sequence');
b = length(a);
x = fft(a,b)
Output :
enter sequence[5 7 9 5]
x =
26.0000 -4.0000 - 2.0000i 2.0000
-4.0000 + 2.0000i
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 52
Experiment -09
To perform IFFT using MATLAB.
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 53
1. Program:
a = input('Enter sequence');
b = length(a);
x = ifft(a,b)
Output:
Enter sequence[1 2 3 4]
x =
2.5000 -0.5000 - 0.5000i -0.5000
-0.5000 + 0.5000i
2. Program :
a = input('Enter sequence');
b = length(a);
x = ifft(a,b)
Output:
Enter sequence[2 5 8 6]
x =
5.2500 -1.5000 - 0.2500i -0.2500
-1.5000 + 0.2500i
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 54
Experiment - 10
To verify sampling theorem using
MATLAB.
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 55
Program:
T=0.04; % Time period of 50 Hz
signal
t=0:0.0005:0.02;
f = 1/T;
n1=0:40;
size(n1)
xa_t=sin(2*pi*2*t/T);
plot(200*t,xa_t);
title('Continuous signal');
grid on;
xlabel('t');
ylabel('x(t)');
Output:
0 0.5 1 1.5 2 2.5 3 3.5 4
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
Continuous signal
t
x(t)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 56
Program:
ts1=0.002; %>Nyquist rate
n=0:20;
x_ts1=2*sin(2*pi*n*ts1/T);
stem(n,x_ts1);
grid on;
title('greater than Nq');
xlabel('n');
ylabel('x(n)');
Output:
0 2 4 6 8 10 12 14 16 18 20
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
greater than Nq
n
x(n)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 57
Program:
ts2=0.01; %=Nyquist rate
n=0:4;
x_ts2=2*sin(2*sym('pi')*n*ts2/T);
stem(n,x_ts2);
grid on;
title('Equal to Nq');
xlabel('n');
ylabel('x(n)');
Output:
0 0.5 1 1.5 2 2.5 3 3.5 4
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
Equal to Nq
n
x(n)
SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1
ELECTRICALDEPARTMENT
BITS EDU CAMPUS Page 58
Program:
ts3=0.1; %<Nyquist rate
n=0:10;
x_ts3=2*sin(2*pi*n*ts3/T);
stem(n,x_ts3);
grid on;
title('less than Nq');
xlabel('n');
ylabel('x(n)');
Output:
0 1 2 3 4 5 6 7 8 9 10
-2.5
-2
-1.5
-1
-0.5
0
0.5
1
1.5
2
x 10
-14 less than Nq
n
x(n)

Contenu connexe

Tendances

ディジタル信号処理の課題解説 その2
ディジタル信号処理の課題解説 その2ディジタル信号処理の課題解説 その2
ディジタル信号処理の課題解説 その2
noname409
 

Tendances (20)

Synchronous machines
Synchronous machinesSynchronous machines
Synchronous machines
 
Počítačové sítě II, lekce 2: Internetworking II
Počítačové sítě II, lekce 2: Internetworking IIPočítačové sítě II, lekce 2: Internetworking II
Počítačové sítě II, lekce 2: Internetworking II
 
Theorems in DE
Theorems in DETheorems in DE
Theorems in DE
 
Logic families
Logic familiesLogic families
Logic families
 
Gto &amp; igct
Gto &amp; igctGto &amp; igct
Gto &amp; igct
 
Single-Sideband Modulation.pptx
Single-Sideband Modulation.pptxSingle-Sideband Modulation.pptx
Single-Sideband Modulation.pptx
 
FRACTIONAL HORSE POWER MOTORS
FRACTIONAL HORSE POWER MOTORSFRACTIONAL HORSE POWER MOTORS
FRACTIONAL HORSE POWER MOTORS
 
電路學Chapter6-1
電路學Chapter6-1電路學Chapter6-1
電路學Chapter6-1
 
Počítačové sítě II, lekce 1: Internetworking
Počítačové sítě II, lekce 1: InternetworkingPočítačové sítě II, lekce 1: Internetworking
Počítačové sítě II, lekce 1: Internetworking
 
Phase locked loop
Phase locked loopPhase locked loop
Phase locked loop
 
Modulo n counter
Modulo n counterModulo n counter
Modulo n counter
 
Sequential Logic Circuits
Sequential Logic CircuitsSequential Logic Circuits
Sequential Logic Circuits
 
Code conversion
Code conversionCode conversion
Code conversion
 
電路學Chapter5
電路學Chapter5電路學Chapter5
電路學Chapter5
 
Module 4 :Ic 555 As A Astable & Monostable Multivibrator
Module 4 :Ic 555 As A Astable & Monostable MultivibratorModule 4 :Ic 555 As A Astable & Monostable Multivibrator
Module 4 :Ic 555 As A Astable & Monostable Multivibrator
 
CRC-32
CRC-32CRC-32
CRC-32
 
Design of stator & rotor for Wound Induction Motor
Design of stator & rotor for Wound Induction MotorDesign of stator & rotor for Wound Induction Motor
Design of stator & rotor for Wound Induction Motor
 
Time base Generators (part-1)
Time base Generators (part-1)Time base Generators (part-1)
Time base Generators (part-1)
 
Solved problems in waveguides
Solved problems in waveguidesSolved problems in waveguides
Solved problems in waveguides
 
ディジタル信号処理の課題解説 その2
ディジタル信号処理の課題解説 その2ディジタル信号処理の課題解説 その2
ディジタル信号処理の課題解説 その2
 

Similaire à signal and system

Dsp 1recordprophess-140720055832-phpapp01
Dsp 1recordprophess-140720055832-phpapp01Dsp 1recordprophess-140720055832-phpapp01
Dsp 1recordprophess-140720055832-phpapp01
Sagar Gore
 

Similaire à signal and system (20)

Dsp lab manual
Dsp lab manualDsp lab manual
Dsp lab manual
 
Digital Signal Processing Lab Manual
Digital Signal Processing Lab Manual Digital Signal Processing Lab Manual
Digital Signal Processing Lab Manual
 
Signals And Systems Lab Manual, R18 Batch
Signals And Systems Lab Manual, R18 BatchSignals And Systems Lab Manual, R18 Batch
Signals And Systems Lab Manual, R18 Batch
 
Dsp manual
Dsp manualDsp manual
Dsp manual
 
dsp.pdf
dsp.pdfdsp.pdf
dsp.pdf
 
Dsp 1recordprophess-140720055832-phpapp01
Dsp 1recordprophess-140720055832-phpapp01Dsp 1recordprophess-140720055832-phpapp01
Dsp 1recordprophess-140720055832-phpapp01
 
Digital Signal Processing Lab Manual ECE students
Digital Signal Processing Lab Manual ECE studentsDigital Signal Processing Lab Manual ECE students
Digital Signal Processing Lab Manual ECE students
 
BS LAB Manual (1).pdf
BS LAB Manual  (1).pdfBS LAB Manual  (1).pdf
BS LAB Manual (1).pdf
 
Multirate sim
Multirate simMultirate sim
Multirate sim
 
Dsp file
Dsp fileDsp file
Dsp file
 
13005810.ppt
13005810.ppt13005810.ppt
13005810.ppt
 
Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report Digital signal Processing all matlab code with Lab report
Digital signal Processing all matlab code with Lab report
 
Introduction to Adaptive filters
Introduction to Adaptive filtersIntroduction to Adaptive filters
Introduction to Adaptive filters
 
EE443 - Communications 1 - Lab 1 - Loren Schwappach.pdf
EE443 - Communications 1 - Lab 1 - Loren Schwappach.pdf EE443 - Communications 1 - Lab 1 - Loren Schwappach.pdf
EE443 - Communications 1 - Lab 1 - Loren Schwappach.pdf
 
Tutorial on convolutional neural networks
Tutorial on convolutional neural networksTutorial on convolutional neural networks
Tutorial on convolutional neural networks
 
R Language Introduction
R Language IntroductionR Language Introduction
R Language Introduction
 
DSP_Lab_MAnual_-_Final_Edition[1].docx
DSP_Lab_MAnual_-_Final_Edition[1].docxDSP_Lab_MAnual_-_Final_Edition[1].docx
DSP_Lab_MAnual_-_Final_Edition[1].docx
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
DSP_Lab_MAnual_-_Final_Edition.pdf
DSP_Lab_MAnual_-_Final_Edition.pdfDSP_Lab_MAnual_-_Final_Edition.pdf
DSP_Lab_MAnual_-_Final_Edition.pdf
 
A Novel Methodology for Designing Linear Phase IIR Filters
A Novel Methodology for Designing Linear Phase IIR FiltersA Novel Methodology for Designing Linear Phase IIR Filters
A Novel Methodology for Designing Linear Phase IIR Filters
 

Plus de SAURAV DAYAL SING (7)

POWER GENERATION SCENERIO IN INDIA
POWER GENERATION SCENERIO IN INDIAPOWER GENERATION SCENERIO IN INDIA
POWER GENERATION SCENERIO IN INDIA
 
Bulk oil and min oil circuit breaker
Bulk oil and min oil circuit breakerBulk oil and min oil circuit breaker
Bulk oil and min oil circuit breaker
 
Theory of HVDC transmission
Theory of HVDC transmission Theory of HVDC transmission
Theory of HVDC transmission
 
THE FABRICATION OF REGULATED DC POWER SUPPLY
THE FABRICATION OF REGULATED DC POWER SUPPLYTHE FABRICATION OF REGULATED DC POWER SUPPLY
THE FABRICATION OF REGULATED DC POWER SUPPLY
 
THEORY OF PRODUCTION AND COST
THEORY OF PRODUCTION AND COSTTHEORY OF PRODUCTION AND COST
THEORY OF PRODUCTION AND COST
 
ELECTRICAL LAMPS AND THEIR TYPES
ELECTRICAL LAMPS AND THEIR TYPESELECTRICAL LAMPS AND THEIR TYPES
ELECTRICAL LAMPS AND THEIR TYPES
 
UKAI HYDRO POWER PLANT VISIT
UKAI HYDRO POWER PLANT VISITUKAI HYDRO POWER PLANT VISIT
UKAI HYDRO POWER PLANT VISIT
 

Dernier

Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
KarakKing
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 

Dernier (20)

Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Google Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptxGoogle Gemini An AI Revolution in Education.pptx
Google Gemini An AI Revolution in Education.pptx
 
Salient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functionsSalient Features of India constitution especially power and functions
Salient Features of India constitution especially power and functions
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.ICT role in 21st century education and it's challenges.
ICT role in 21st century education and it's challenges.
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Fostering Friendships - Enhancing Social Bonds in the Classroom
Fostering Friendships - Enhancing Social Bonds  in the ClassroomFostering Friendships - Enhancing Social Bonds  in the Classroom
Fostering Friendships - Enhancing Social Bonds in the Classroom
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Single or Multiple melodic lines structure
Single or Multiple melodic lines structureSingle or Multiple melodic lines structure
Single or Multiple melodic lines structure
 

signal and system

  • 1. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 1 Babaria Institute of Technology Electrical Engineering Department Semester :4 Branch:EE Subject: Signals & Systems (2141005) Experiment No. 1 Aim: To familiarize with MATLAB software, general functions and signal processing toolbox functions. The name MATLAB stands for MATrix LABoratory produced by Mathworks Inc., USA. It is a matrix-based powerful software package for scientific and engineering computation and visualization. Complex numerical problems can be solved in a fraction of the time that required with other high level languages. It provides an interactive environment with hundreds of built -in –functions for technical computation, graphics and animation. In addition to built-in-functions, user can create his own functions. MATLAB offers several optional toolboxes, such as signal processing, control systems, neural networks etc. It is command driven software and has online help facility. MATLAB has three basic windows normally; command window, graphics window and edit window. Command window is characterized by the prompt ‘>>’. All commands and the ready to run program filename can be typed here. Graphic window gives the display of the figures as the result of the program. Edit window is to create program files with an extension .m. Some important commands in MATLAB Help : List topics on which help is available Help command name: Provides help on the topic selected Demo : Runs the demo program Who : Lists variables currently in the workspace Whos : Lists variables currently in the workspace with their size Clear : Clears the workspace, all the variables are removed Clear x,y,z : Clears only variables x,y,z Quit: Quits MATLAB
  • 2. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 2 Some of the frequently used built-in-functions in Signal Processing Toolbox filter(b.a.x): Syntax of this function is Y = filter(b.a.x) It filters the data in vector x with the filter described by vectors a and b to create the filtered data y. fft (x): It is the DFT of vector x ifft (x) : It is the DFT of vector x conv (a,b) : Syntax of this function is C = conv (a,b) It convolves vectors a and b. The resulting vector is ofLength, Length (a) + Length (b)-1 deconv(b,a): Syntax of this function is [q,r] = deconv(b,a) It deconvolves vector q and the remainder in vector r such that b = conv(a,q)+r butter(N,Wn): Designs an Nth order lowpass digital Butterworth filter and returns the filter coefficients in length N+1 vectors B (numerator) and A (denominator). The coefficients are listed in descending powers of z. The cutoff frequency Wn must be 0.0 < Wn < 1.0, with 1.0 corresponding tohalf the sample rate. buttord(Wp, Ws, Rp, Rs): Returns the order N of the lowest order digital Butterworth filter that loses no more than Rp dB in the passband and has at least Rs dB of attenuation in the stopband. Wp and Ws are the passband and stopband edge frequencies, Normalized from 0 to 1 ,(where 1 corresponds to pi rad/sec) Cheby1(N,R,Wn) : Designs an Nth order lowpass digital Chebyshev filter with R decibels of peak-to-peak ripple in the passband. CHEBY1 returns the filter coefficients in length N+1 vectors B (numerator) and A (denominator). The cutoff frequency Wn must be 0.0 < Wn < 1.0, with 1.0 corresponding to half the sample rate. Cheby1(N,R,Wn,'high'): Designs a highpass filter.
  • 3. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 3 Cheb1ord(Wp, Ws, Rp, Rs): Returns the order N of the lowest order digital Chebyshev Type I filter that loses no more than Rp dBin the passband and has at least Rs dB of attenuation in the stopband. Wp and Ws are the passband and stopband edge frequencies, normalized from 0 to 1 (where 1 corresponds to pi radians/sample) cheby2(N,R,Wn) : Designs an Nth order lowpass digital Chebyshev filter with the stopband ripple R decibels down and stopband edge frequency Wn. CHEBY2 returns the filter coefficients in length N+1 vectors B (numerator) and A. The cutoff frequency Wn must be 0.0 < Wn < 1.0, with 1.0 corresponding to half the sample rate. cheb2ord(Wp, Ws, Rp, Rs): Returns the order N of the lowest order digital Chebyshev Type II filter that loses no more than Rp dB in the passband and has at least Rs dB of attenuation in the stopband. Wp and Ws are the passband and stopband edge frequencies. abs(x): It gives the absolute value of the elements of x. When x is complex, abs(x) is the complex modulus (magnitude) of the elements of x. angle(H): It returns the phase angles of a matrix with complex elements in radians. freqz(b,a,N) : Syntax of this function is [h,w] = freqz(b,a,N) returns the Npoint frequency vector w in radians and the N-point complex frequency response vector h of the filter b/a. stem(y) : It plots the data sequence y aa stems from the x axis terminated with circles for the data value. stem(x,y): It plots the data sequence y at the values specified in x. ploy(x,y) : It plots vector y versus vector x. If x or y is a matrix, then the vector is plotted versus the rows or columns of the matrix,cwhichever line up. title(‘text’): It adds text at the top of the current axis. xlabel(‘text’): It adds text beside the x-axis on the current axis. ylabel(‘text’): It adds text beside the y-axis on the current axis.
  • 4. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 4 Experiment :2 To plot graph of Continuous Time Signals
  • 5. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 5 Unit step function Program : T=30; x=ones(1,T); t=0:1:T-1 plot(t,x); grid on; xlabel('time(sec)') ylabel('x(t)') Output : 0 5 10 15 20 25 30 0 0.5 1 1.5 2 time(sec) x(t)
  • 6. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 6 Unit ramp function Program : t=0:0.03:4; x=t; plot(t,x) grid on; xlabel('Time(sec)') ylabel('x(t)') Output : 0 1 2 3 4 0 1 2 3 4 Time(sec) x(t)
  • 7. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 7 Unit parabolic function Program : t=0:0.01:2; x=t.^2/2; plot(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output : 0 0.5 1 1.5 2 0 0.5 1 1.5 2 Time(sec) x(t)
  • 8. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 8 Impulse function Program : for t = 0; x = 1; end; plot(t,x); stem(t,x) grid on; xlabel('Time(sec)') ylabel('x(t)') Output : -1 -0.5 0 0.5 1 0 0.2 0.4 0.6 0.8 1 Time(sec) x(t)
  • 9. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 9 Rectangular pulse function Program : t=-1:0.001:1; x=rectpuls(t); plot(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output : -1 -0.5 0 0.5 1 0 0.2 0.4 0.6 0.8 1 Time(sec) x(t)
  • 10. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 10 Triangular pulse function Program : t=-1:0.002:1; x=tripuls(t); plot(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output: Signum function -1 -0.5 0 0.5 1 0 0.2 0.4 0.6 0.8 1 Time(sec) x(t)
  • 11. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 11 Program : t=-10:0.001:10; x=sign(t); plot(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output: -10 -5 0 5 10 -1 -0.5 0 0.5 1 Time(sec) x(t)
  • 12. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 12 Sinc function Program : t =-4:0.05:4; x=sinc(t); plot(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output: -4 -2 0 2 4 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 Time(sec) x(t)
  • 13. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 13 Gaussian function Program : t=-5:0.03:5; a=1; x=exp(-a*t.^2); plot(t,x) grid on; xlabel('Time(sec)') ylabel('x(t)') Output : -5 0 5 0 0.2 0.4 0.6 0.8 1 Time(sec) x(t)
  • 14. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 14 Sinusoidal signal Program : t=0:0.01:2; x=2*sin(pi*t); plot(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output : 0 0.5 1 1.5 2 -2 -1 0 1 2 Time(sec) x(t)
  • 15. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 15 Real exponential signals Program : t=0:0.04:4; x=2*exp(1*t); plot(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output : 1. a>0 0 1 2 3 4 0 10 20 30 40 50 60 Time(sec) x(t)
  • 16. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 16 Program : t=0:0.04:4; x=2*exp(-1*t); plot(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output : 2. a<0 Program : 0 1 2 3 4 0 0.2 0.4 0.6 0.8 1 Time(sec) x(t)
  • 17. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 17 t=0:0.04:4; x=2*exp(0*t); plot(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output : 3. a=0 0 1 2 3 4 -1 -0.5 0 0.5 1 Time(sec) x(t)
  • 18. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 18 Complex exponential function Program : t=-10:0.001:10; c=complex(0,1); x=exp(c*t); plot(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output : -10 -5 0 5 10 -1 -0.5 0 0.5 1 Time(sec) x(t)
  • 19. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 19 Program : t=-10:0.001:10; c=complex(-1,12); x=exp(c*t); plot(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output : -10 -5 0 5 10 -2 -1 0 1 2 3 x 10 4 Time(sec) x(t)
  • 20. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 20 Program : t=-10:0.001:10; c=complex(1,12); x=exp(c*t); plot(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output : -10 -5 0 5 10 -2 -1 0 1 2 3 x 10 4 Time(sec) x(t)
  • 21. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 21 Experiment :3 To plot graph of Discrete Time Signals
  • 22. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 22 Unit step sequence Program : T=30; x=ones(1,T); t=0:1:T-1 stem(t,x); grid on; xlabel('time(sec)') ylabel('x(t)') Output : 0 5 10 15 20 25 30 0 0.2 0.4 0.6 0.8 1 time(sec) x(t)
  • 23. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 23 Unit ramp sequence Program : t=0:0.5:4; x=t; stem(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output : 0 1 2 3 4 0 1 2 3 4 Time(sec) x(t)
  • 24. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 24 Unit impulse sequence Program : for t = 0; x = 1; end; plot(t,x); stem(t,x) grid on; xlabel('Time(sec)') ylabel('x(t)') Output : -1 -0.5 0 0.5 1 0 0.2 0.4 0.6 0.8 1 Time(sec) x(t)
  • 25. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 25 Exponential sequence Program : t=0:0.35:4; x=2.^t; stem(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output : 0 1 2 3 4 0 10 20 30 40 50 Time(sec) x(t)
  • 26. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 26 Program : t=0:0.35:4; x=0.2.^t; stem(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output : 0 1 2 3 4 0 0.2 0.4 0.6 0.8 1 Time(sec) x(t)
  • 27. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 27 Program : t=0:0.35:4; x=-0.2.^t; stem(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output : 0 1 2 3 4 -1 -0.8 -0.6 -0.4 -0.2 0 Time(sec) x(t)
  • 28. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 28 Program : t=0:0.35:4; x=-2.^t; stem(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output : 0 1 2 3 4 -15 -10 -5 0 Time(sec) x(t)
  • 29. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 29 Sinusoidal sequence Program : t=0:0.1:2; x=2*sin(pi*t); stem(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output : 0 0.5 1 1.5 2 -2 -1 0 1 2 Time(sec) x(t)
  • 30. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 30 Complex exponential sequence Program : t=-10:0.3:10; c=complex(0.3,4); x=exp(c*t); stem(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output : -10 -5 0 5 10 -15 -10 -5 0 5 10 15 20 Time(sec) x(t)
  • 31. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 31 Program : t=-10:0.3:10; c=complex(0.3,4); x=exp(c*t); stem(t,x); grid on; xlabel('Time(sec)') ylabel('x(t)') Output : -10 -5 0 5 10 -15 -10 -5 0 5 10 15 20 Time(sec) x(t)
  • 32. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 32 Experiment :04 To perform signal operation using stimulink
  • 33. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 33 Program : u(t)-u(t-1) Output :
  • 34. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 34 Program : r(t)-2r(t-1)+r(t-2) Output :
  • 35. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 35 Program : r(t)-2u(t-1)-r(t-2) Output :
  • 36. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 36 Program : r(t)-r(t-1)-u(t-1) Output :
  • 37. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 37 Experiment :05 To perform the convolution sum of discrete time signal.
  • 38. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 38 Program : a=[ 1 -1 2 3]; b=[ 1 -2 3 -1]; z=conv(a,b); m=length(z); y=0:m-1; stem(y,z); Output : 0 1 2 3 4 5 6 -5 0 5 10 a b
  • 39. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 39 Program : a=[ 1 2 3 2]; b=[ 1 2 2]; z=conv(a,b); m=length(z); y=0:m-1; stem(y,z); Output : 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 0 5 10 15 a b
  • 40. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 40 Program : a=[ 1 4 3 2]; b=[ 1 3 2 1]; z=conv(a,b); m=length(z); y=0:m-1; stem(y,z); Output : 0 1 2 3 4 5 6 0 5 10 15 20 a b
  • 41. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 41 Program: a=[ 1 -2 3 1]; b=[ 2 -3 -2]; z=conv(a,b); m=length(z); y=0:m-1; stem(y,z); Output: 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 5 -10 -5 0 5 10 a b
  • 42. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 42 Experiment :06 To perform z-transform using MATLAB
  • 43. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 43 Program : syms f n; f=2^n; ztrans(f); Output : z/(z - 2) Program : syms f n w; f=cos(n); ztrans(f); Output : (z*(z - cos(1)))/(z^2 - 2*cos(1)*z + 1)
  • 44. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 44 Program : syms f n w; f=2^n+3^n; ztrans(f); Output : z/(z - 2) + z/(z - 3) Program : syms f n w; f=(n^2)*(2^n); ztrans(f); Output : (z^2/4 + z/2)/(z/2 - 1)^3
  • 45. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 45 Experiment :07 To plot zeros and poles in the z-plane using MATLAB.
  • 46. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 46 Program : syms n d z n=[1 1]; d=[1 2 3 4]; sys=tf(n,d),disp(z); zplane(n,d); Output : s + 1 s^3 + 2 s^2 + 3 s + 4 -2 -1.5 -1 -0.5 0 0.5 1 1.5 -1.5 -1 -0.5 0 0.5 1 1.5 2 Real Part ImaginaryPart
  • 47. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 47 Program : syms n d z n=[1 0.5]; d=[1 1 1]; sys=tf(n,d),disp(z); zplane(n,d); Output : s + 0.5 s^2 + s + 1 -1.5 -1 -0.5 0 0.5 1 1.5 -1 -0.5 0 0.5 1 Real Part ImaginaryPart
  • 48. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 48 Program : syms n d z n=[3 0]; d=[1 6 9]; sys=tf(n,d),disp(z); zplane(n,d); Output : 3 s s^2 + 6 s + 9 -3 -2 -1 0 1 -1 -0.5 0 0.5 1 22 Real Part ImaginaryPart
  • 49. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 49 Program : syms n d z n=[1 1 0]; d=[1 3 1 1]; sys=tf(n,d),disp(z); zplane(n,d); Output : s^2 + s s^3 + 3 s^2 + s + 1 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 -1 -0.5 0 0.5 1 2 Real Part ImaginaryPart
  • 50. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 50 Experiment -08 To perform FFT using MATLAB.
  • 51. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 51 1. Program: a = input('enter sequence'); b = length(a); x = fft(a,b) Output: Enter sequence[1 2 3 4] x = 10.0000 -2.0000 + 2.0000i -2.0000 -2.0000 - 2.0000i 2. Program : a = input('enter sequence'); b = length(a); x = fft(a,b) Output : enter sequence[5 7 9 5] x = 26.0000 -4.0000 - 2.0000i 2.0000 -4.0000 + 2.0000i
  • 52. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 52 Experiment -09 To perform IFFT using MATLAB.
  • 53. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 53 1. Program: a = input('Enter sequence'); b = length(a); x = ifft(a,b) Output: Enter sequence[1 2 3 4] x = 2.5000 -0.5000 - 0.5000i -0.5000 -0.5000 + 0.5000i 2. Program : a = input('Enter sequence'); b = length(a); x = ifft(a,b) Output: Enter sequence[2 5 8 6] x = 5.2500 -1.5000 - 0.2500i -0.2500 -1.5000 + 0.2500i
  • 54. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 54 Experiment - 10 To verify sampling theorem using MATLAB.
  • 55. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 55 Program: T=0.04; % Time period of 50 Hz signal t=0:0.0005:0.02; f = 1/T; n1=0:40; size(n1) xa_t=sin(2*pi*2*t/T); plot(200*t,xa_t); title('Continuous signal'); grid on; xlabel('t'); ylabel('x(t)'); Output: 0 0.5 1 1.5 2 2.5 3 3.5 4 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 Continuous signal t x(t)
  • 56. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 56 Program: ts1=0.002; %>Nyquist rate n=0:20; x_ts1=2*sin(2*pi*n*ts1/T); stem(n,x_ts1); grid on; title('greater than Nq'); xlabel('n'); ylabel('x(n)'); Output: 0 2 4 6 8 10 12 14 16 18 20 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 greater than Nq n x(n)
  • 57. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 57 Program: ts2=0.01; %=Nyquist rate n=0:4; x_ts2=2*sin(2*sym('pi')*n*ts2/T); stem(n,x_ts2); grid on; title('Equal to Nq'); xlabel('n'); ylabel('x(n)'); Output: 0 0.5 1 1.5 2 2.5 3 3.5 4 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 Equal to Nq n x(n)
  • 58. SIGNALS & SYSTEMS (2141005) EXPERIMENT- 1 ELECTRICALDEPARTMENT BITS EDU CAMPUS Page 58 Program: ts3=0.1; %<Nyquist rate n=0:10; x_ts3=2*sin(2*pi*n*ts3/T); stem(n,x_ts3); grid on; title('less than Nq'); xlabel('n'); ylabel('x(n)'); Output: 0 1 2 3 4 5 6 7 8 9 10 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5 2 x 10 -14 less than Nq n x(n)