Professional Documents
Culture Documents
DSP 5 TH Sem Lab
DSP 5 TH Sem Lab
A (1 2, 3 4)
8(S 6; 8 9]
disp(onc atenat i on )
C [A, 8)
d [A, 8)
Command Window
concatenation
1 5 6
3
Experiment 2: (set3)
subplot (2,2, 1);
tlinspace(-15, 15);
y*sin(t);
plot (t, y);
title('sine function );
xlabel(t(sec)');
ylabel('s(t) ');
subplot (2, 2, 2) ;
stem(t, y)
title( 'Discrete sine function' );
xlabel('t(sec) "):
ylabel('s(t) ');
subplot (2,2,3);
t-linspace(-15, 15) ;
y=cos (t);
plot (t , y);
Mallabhum Institute of Technology. Bishnupur
title(
Department of Eleetronies and Communications Engineering
ic :
xlabel(i'):
ylabel( ):
subplot(2,2,4);
sten(t.y):
title(Discrete tasine funct ion );
xlabel(t(sec)");
ylabel('(t))i
Sine function
Discrete sine function
05
05|
05
-05
-20 10 1
10 20 -20 10 20
(sec)
(sec)
cosine function Discrete cosine function
1
20 10 10 2 20 10 10
(sec) 20
t(sec)
subplot (2, 2,1);
t-linspace (0, 15) ;
y=exp(-t);
plot(t,y);
title(falling exponent ial function');
xlabel('t(sec)');
ylabel ('e(t)');
subplot (2,2, 2);
stem(t ,y);
title(Discrete falling exponential function ');
xlabel('t(sec) ');
ylabel ('e(t)');
subplot (2,2, 3):
t-linspace(-30, 30) ;
y=exp(e.1*t);
plot (t ,y);
title('rising exponential function'):
xlabel ('t(sec)'):
ylabel('e(t)');
subplot(2,2,4) ;
stem(t, y) ;
Mallabhum Institute of Technology, Bishnupur
Department of Electronies and Communications Engineering
title( );
xlabel ( ).
ylabel( ):
subplot (2, 2, 1) ;
t=-10: 10:
y-[zeros (1, 5), ones (1,11),zeros (1,5) ):
stem(t ,y);
title( Discrete rectagular function' );
xlabel ((t(sec));
ylabe l (Crt) );
subplot(2, 2,2);
te-30:30;
output ((1-2*abs(t))/20);
plot (t, output );
title('triangular wave );
xlabel(t(se) ):
ylabel(x(t) D:
subplot (2,2,3);
tlinspace(-7,7);
yesinc (2*3.14*e. 1*t);
stem (t,y);
title( ' Discrete sinc function ');
xlabel((t(sec));
ylabel('sinc (t)" ):
subplot (2,2,4);
plot (t,y):
title( sinc funct ion):
xlabel(t(sec));
ylabel(sinc(t) );
Mallabhum Institute of Technology, Bishnupur
Departmentof Electronics and Communications Engineering
20
t(sec) ñsec)
Discrete sinc function sinc function
1
10 05
0 10
(sec) (sec)
Experimnent 3: (set3)
t--2:1:2;
y[zeros (1,2), ones (1,1), zeros(1,2)]:
subplot (2, 2, 1);
stem (t .y);
ylabe l (d(n) ' );
Klabel(unit impul se );
n=input ('Enter n values );
t=0:1 :n-1;
steets2,2):
t, yl) ;
ylabe l(' Anp litude ');
xlabel( un it step );
n=input(Enter n values');
t e@:1:n-1:
subplot (2,2,3);
sten(t,t)i
ylabel ( Ampl it ude');
xlabel((unit ramp' );
s(1.3), (,9. r s t
pubplot (2, 2,1)1
bt(ys
lebel('()")
ldl(ait inpul)
input(Cnter n velues)
-nes(,)I
uplot (2,2,2)3
ee(-y1):
teeths
nd Wndo
Experiment 4: (set3)
t =0:0,001:0,1
f=25;
t1=2°p1*f*t;
x1=1+cos (t1);
subplot (3,1,1)
plot(t, x1)
title('x1')
Mallabhun Institute of Technology. Bishnupur
Department of Electronics and Communications Engineering
2sin(t1)
subplot (3,1,2)
plot (t,x2)
title()
y=x]+xK2
subplot (3,1,9)
plot(t,y)
title(y xl +x2(Add1t ion of two sign als) )
xl abel(ine')
ylabel( Amplitude )
o02 04
Tirne
t -0:0.01:0.1
f-100,
tl-2°pi"f*t;
epart d Elct d C
Mallabhum Institutfe of Technology. Bishnupur
Department of Electronics and Communications Engineering
y xx2Multiplication)
002
Trme
te:e.02:3epi
xsin(t).
subplot (3, 1,1)
plot (t, M)
r1d or,
y*sin(t/2)
xlabel ( Tie )
ylabel ((Ampl it ude)
grid on,
Mallabhum Institute of Technology, Bishnupur
Department of Electronics and Communications Engineering
z*sin(t*2)
subplot (3,1,3)
plot(t,z)
xlabel(ime')
ylabel( Amplitude )
grid on;
Fe1
Simple Signal
50
Time
Expanded Signal
RO 100
Time
Compressed Signal
100
Timw
ta0:10;
x=(0 1 2 1 0 1 2 1 2 1 1:
subplot(3,1,1)
plot (t, x)
title('Simple Signal')
xlabel (Time' )
axis((-8 8e 4));
Mallabhun Institute of Technology, Bishnupur
Department of Electronics and Communications Engineering
subpiot (3, 1,2)
plot(t6, x)
axis([ -8 8 4));
subplot (3,1, 3)
plot (t -6, x)
xlabel(Time')
ylabel (Ampl itude')
grid on;
axis([-8 8 4]);
Fe!
Simple Signal
Tirne
Shifting by addition
Time
Shifting by Subtraction
6 2
Time
t =0:10;
K=(e 1 2 3 4 -5 -6 -7 -8 -9 -1e];
Mallabhum Institute of Technology, Bishnupur
Department of Electronics and Communications Engineering
subplot (2,1,1)
ste(t,x)
grid on;
y=fliplr(x) ;
stem(t,y)
title('Reverse ')
xlabel('lime')
ylabel(' Ampl itude' )
grid on;
Figue 1
Simple Signal
Impltud
2 6
Time
Reverse
Ampltude
10 4 6 B 10
Time
Experiment 5: (set3)
x=input ('enter x[n] ');
heinput( 'Enter h[n]');
a-length(x) ;
Mallabhum Institute of Technology, Bishnupur
Department of Electronics and Communications Engineering
b-lergtn();
Winput
for nl:3+b-1; po.in
for ka1:
K:a;
1f (no1) >k&8((n+1)-k)estb;
end
Ses-(z(k) *h((n+1 -k)));
end
y(n)=s:
t=-q-w:
sten(nst+1,y (n));
hold on;
end
disp(y);
yl= deconv(y,h)
72&
L&22:AA
3
Mallabhum Institute of Technology, Bishnupur
Department of Electronics and Communications Engineering
25
20
15
10
10 12 14 16 18
2 4 6
Experiment 6: (set1)
clc;
clear all;
close all;
al=input('enter the al sequence al=)
bl=input('enter the b1 sequence bl=')
cl=input('enter the c1 sequence cl=)
l-max(length (a1) , length (b1))
N=max (N1, length (c1))
a-[al, zeros (1, N- length(a1)));
b=(bl,zeros (1, N-length(b1))];
c-[c1,zeros (1, N-length(c1))];
X=Cconv(a, b, N1)
yscconv(b, a, N1) %commutative property
1f
disp(' commutative property is proved')
else
disp(' commutatíve property is not proved' )
end
t=cconv(b, c, N) ;
yl=cconv(a,t,N) associat ive property
y2=cconv(x, c,N)
if yl=y2
disp('associative property is proved')
else
disp('associative property is not proved')
end
ti= b C
1Mallabhum Institute of Technology, Bixhnupur
Department of Flectronics and Communications Engineering
a
25 29
hepastdss d agiring
tn
Iatit
Mallabhum Institute of Technology, Bishnupur
Department of Electronies and Communications Engineering
alength(x),
x[ zeros(1 ,N-a) ]:
tor ke0:N-1
sum(k"1) -0;
for ne:N-1
sum(k"1)-sum(k+1) +(x(n+1) *exp((-i*2*pi"(k)" (n) /N) ) ):
end
subplot (2,2,1);
sten(real(sun));
title( 'DF );
Klabel(n);
ylabel ( Real(x)):
subplot (2,2, 2) ;
sten(imag( sum) );
title( ' DFT );
xlabel(n );
vìabel ( imag(x) );
hold on;
end
disp(sum);
for n : N - 1
Sum2(n+1) ;
for k @:N-1
2 pi (n) (k)/N) );
Sum2(n+1) sum2 (n+1) " (sum(k+1) exp{1
end
subplot (2,2, 3) ;
sten(real(sum2/N));
title(" IDFT')
ylabel( real (x1) ):
Mlabel(n ;
subplot(2,2,4) ;
stem(imag( sum2/N) ):
inag(x1) ');
xlabel(n );
end
disp(sum2/N) ;
Mallabhum Institute of Technology. Bishnupur
Department of Electronics and Communications Engineering
Crn
Output:
generat ionofsineeNp
N
)
Mallabhum Intitute of Lebnotgy, Bihnupur
Department of Eletronies and Communicatins Engnering
w1)
WZ)
W) 8,9099)
w4)
W(S)
The i e twiddle factors are (Periodscity Prsperty)
1.9609.409)
M1+6)
9.86441
W2+6)*
wB+6)
1.9990
W(4+6)
WS+6)->
Wi3).
w 3)
W4+3)
WS+3)
Mallabhum Institute of Technology, Bishnupur
Departnent of Electronies and Communieations Engineering
Experiment 11: (set3)
y 4 26 R 1.
conv(,y)
xpad | zeros(1,6-1length(x))l:
ypad ly zeros(1,6-1ength(y))):
(Are 1fft(fft ( Mpad).ft(ypad))
subplot (2,1,1);
stem(clin,led):
ylim ((e 1 1|):
title(Linear convolut l on')
subplot (2,1,2);
stem(cir, Illed' );
ylim - ([e 1 1));
title(rcular convolut ion')
VEd y nrost(1,-length(y))l
ceire 1frr(tf(upad).tftrad))
subplot(2.1.1)1
sto(clin,"LledH
4n4,lres
trtratler s*:tntteg
24