LAB TASKs
Answer no. 01):-
Code in command window:-
clc;
clear all;
close all;
n=0:10;
x=zeros(1,length(n));
x(1,2)=1;
y = fft(x);
figure;
subplot(211);
stem(x);
title('in TIme Domain')
subplot(212);
plot(abs(y))
axis([1,10,0,1.5])
title('In frequency Domain')
PART B
clc;
clear all;
close all;
% fs=12;
Digital Signal Processing Lab Page 1
n=0:1/6:11;
x=cos(2*pi*n);
y=abs(fft(x));
subplot(211);
stem(n,x);
title('in TIme Domain')
subplot(212);
plot(y)
title('In frequency Domain')
PART C
clc;
clear all;
close all;
n=0:1/100:20;
x=sinc(n);
figure;
subplot(211);
stem(x);
title('In time domain');
Y=(fft(x));
subplot(212);
% axis([0,10,0,1]);
plot(abs(Y));
% axis([0,10,0,1]);
Digital Signal Processing Lab Page 2
Answer no. 02):-
COMMENTS;;
In the fast signal in time have high frequency near to pi
and similarly in the slow signal in time have high
frequency near to zeros
Digital Signal Processing Lab Page 3
Answer no. 03):-
Code in command window:-
clc;
clear all;
close all;
n=0:10;
a = [8 -2 -1]; % left hand side of difference
equation
b = [1 1 0]; % right hand side of difference
equation
x=2.^n;
z=filter(b,a,x);
figure;
subplot(211)
stem(n,z);
title('IIR in time Domain');
y=abs(fft(z));
subplot(212);
plot(n,y);
title('IIR in frequency Domain');
Digital Signal Processing Lab Page 4
Answer no. 04):-
Code in command window:-
clc;
clear all;
close all;
n=0:10;
x=zeros(1,length(n));
x(1,2)=1;
y = fft(x);
figure;
subplot(211);
stem(x);
title('in TIme Domain')
subplot(212);
plot(phase(y))
% axis([1,10,0,1.5])
title('In frequency Domain')
clc;
clear all;
close all;
% fs=12;
n=0:1/6:11;
x=cos(2*pi*n);
Digital Signal Processing Lab Page 5
y=phase(fft(x));
subplot(211);
stem(n,x);
title('in TIme Domain')
subplot(212);
plot(y)
title('In frequency Domain')
Digital Signal Processing Lab Page 6
clc;
clear all;
close all;
n=0:1/100:20;
x=sinc(n);
figure;
subplot(211);
stem(x);
title('In time domain');
Y=(fft(x));
subplot(212);
plot(phase(Y));
Digital Signal Processing Lab Page 7