0% found this document useful (0 votes)
55 views11 pages

Code For 16

This document provides code for calculating a 16-point discrete Fourier transform (DFT). It defines vectors for the input data, transformation matrix, and output. It then performs the matrix multiplication to calculate the DFT and stores the results in a vector to return the frequency domain representation of the original time domain signal.

Uploaded by

Usman Farooq
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views11 pages

Code For 16

This document provides code for calculating a 16-point discrete Fourier transform (DFT). It defines vectors for the input data, transformation matrix, and output. It then performs the matrix multiplication to calculate the DFT and stores the results in a vector to return the frequency domain representation of the original time domain signal.

Uploaded by

Usman Farooq
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 11

CODE FOR 16-POINT DFT:

x=[1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16]
A=[1 1 1 1;1 -i -1 i;1 -1 1 -1;1 i -1 -i]
B=[x(1);x(5);x(9);x(13)]
C=A*B
D=[x(2);x(6);x(10);x(14)]
E=A*D
F=[x(3);x(7);x(11);x(15)]
G=A*F
H=[x(4);x(8);x(12);x(16)]
I=A*H
K=[C(1);E(1);G(1);I(1)]
SID=A*K
L=[C(2);(0.924-0.383i)*E(2);(0.707-0.707i)*G(2);(0.3830.924i)*I(2)]
AXA=A*L
M=[C(3);(0.707-0.707i)*E(3);(-i)*G(3);(-0.7070.707i)*I(3)]
HON=A*M
N=[C(4);(0.383-0.924i)*E(4);(-0.707-0.707i)*G(4);(0.924+0.383i)*I(4)]
MAR=A*N
X=[SID(1) AXA(1) HON(1) MAR(1) SID(2) AXA(2) HON(2)
MAR(2) SID(3) AXA(3) HON(3) MAR(3) SID(4) AXA(4) HON(4)
MAR(4)]

x =

Columns 1 through 12

10

1
11

2
12

Columns 13 through 16

13

14

15

16

A =

1.0000
1.0000
1.0000
0 + 1.0000i
1.0000
-1.0000
1.0000
0 - 1.0000i

1.0000
0 - 1.0000i
-1.0000
0 + 1.0000i

1.0000
-1.0000
1.0000
-1.0000

B =

1
5
9
13

C =

28.0000
-8.0000 + 8.0000i
-8.0000
-8.0000 - 8.0000i

D =

2
6
10
14

E =

32.0000
-8.0000 + 8.0000i
-8.0000
-8.0000 - 8.0000i

F =

3
7
11
15

G =

36.0000
-8.0000 + 8.0000i
-8.0000
-8.0000 - 8.0000i

H =

4
8
12
16

I =

40.0000
-8.0000 + 8.0000i
-8.0000
-8.0000 - 8.0000i

K =

28
32
36

40

SID =

1.0e+002 *

1.3600
-0.0800 + 0.0800i
-0.0800
-0.0800 - 0.0800i

L =

-8.0000 + 8.0000i
-4.3280 +10.4560i
0 +11.3120i
4.3280 +10.4560i

AXA =

-8.0000 +40.2240i
-8.0000 + 5.3440i
-8.0000 - 1.6000i
-8.0000 -11.9680i

M =

-8.0000
-5.6560 + 5.6560i
0 + 8.0000i
5.6560 + 5.6560i

HON =

-8.0000 +19.3120i
-8.0000 + 3.3120i
-8.0000 - 3.3120i
-8.0000 -19.3120i

N =

-8.0000 - 8.0000i
-10.4560 + 4.3280i
0 +11.3120i
10.4560 + 4.3280i

MAR =

-8.0000 +11.9680i
-8.0000 + 1.6000i
-8.0000 - 5.3440i
-8.0000 -40.2240i

X =

1.0e+002 *

Columns 1 through 4

1.3600
-0.0800 + 0.4022i
0.1931i -0.0800 + 0.1197i

-0.0800 +

Columns 5 through 8

-0.0800 + 0.0800i -0.0800 + 0.0534i


0.0331i -0.0800 + 0.0160i

-0.0800 +

Columns 9 through 12

-0.0800
-0.0800 - 0.0160i
0.0331i -0.0800 - 0.0534i

-0.0800 -

Columns 13 through 16

-0.0800 - 0.0800i -0.0800 - 0.1197i


0.1931i -0.0800 - 0.4022i

fft(x)

ans =

1.0e+002 *

Columns 1 through 4

-0.0800 -

1.3600
-0.0800 + 0.4022i
0.1931i -0.0800 + 0.1197i

-0.0800 +

Columns 5 through 8

-0.0800 + 0.0800i -0.0800 + 0.0535i


0.0331i -0.0800 + 0.0159i

-0.0800 +

Columns 9 through 12

-0.0800
-0.0800 - 0.0159i
0.0331i -0.0800 - 0.0535i

-0.0800 -

Columns 13 through 16

-0.0800 - 0.0800i -0.0800 - 0.1197i


0.1931i -0.0800 - 0.4022i

fft(x)

-0.0800 -

ASSIGNMENT NO. 1

You might also like