Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

Exp No.3.

To Study Properties of DFT


Roll No. :36 Name: Moharir Saurabh Bhanudas

1) Complex Conjugate Property:


MATLAB Code:
clc;
close all;
clear all;
%%DFT
N=input('Enter the no of samples:');
xn=input('Enter the original sequence:');
xk=fft(xn,N)
k=0:1:N-1;
subplot(2,1,1);
stem(k,abs(xk));
title('Magnitude Plot');
xlabel('k');
ylabel('|xk|');
subplot(2,1,2);
stem(k,angle(xk));
title('Phase Plot');
xlabel('k');
ylabel('Angle|xk|');

Command Window:
Enter the no of samples:4
Enter the original sequence:[1 2 3 4]

xk =

10.0000 -2.0000 + 2.0000i -2.0000 -2.0000 - 2.0000i

>>
Output:

2) Periodicity
MATLAB Code:
clc;
close all;
clear all;
%%DFT
N=input('Enter the no of samples:');
xn=input('Enter the original sequence:');
xn=[xn xn xn]
xk=fft(xn,N)
k=0:1:N-1;
subplot(2,1,1);
stem(k,abs(xk));
title('Magnitude Plot');
xlabel('k');
ylabel('|xk|');
subplot(2,1,2);
stem(k,angle(xk));
title('Phase Plot');
xlabel('k');
ylabel('Angle|xk|');

Command Window:
Enter the no of samples:4
Enter the original sequence:[1 2 3 4]

xk =

10.0000 -2.0000 + 2.0000i -2.0000 -2.0000 - 2.0000i

>>

Output:

3) Linearity:
MATLAB Code:
clc;
close all;
clear all;
%%DFT Linearty
N=input('Enter the no of samples');
xn1=input('Enter the 1st sequence');
xn2=input('Enter the 2nd sequence');
a1=input('Enter the value of constant a1:');
a2=input('Enter the value of constant a2:');
y=(a1*xn1)+(a2*xn2);
z=fft(y,N)
xk1=fft(xn1,N)
xk2=fft(xn2,N)
z1=a1*xk1+a2*xk2
--------------------------------------------------------------------------
Command Window:
Enter the no of samples4
Enter the 1st sequence[1 0 1 1]
Enter the 2nd sequence[1 1 1 1]
Enter the value of constant a1:2
Enter the value of constant a2:3

z=

18.0000 0 + 2.0000i 2.0000 0 - 2.0000i

xk1 =

3.0000 0 + 1.0000i 1.0000 0 - 1.0000i

xk2 =

4 0 0 0

z1 =

18.0000 0 + 2.0000i 2.0000 0 - 2.0000i

>>

You might also like