-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDFT.m
31 lines (27 loc) · 789 Bytes
/
DFT.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
% ==========================================================================
%> @brief computes N - point Discrete Fourier Transform
%> called by ::DFT
%>
%> @param Signal: Discrete Time Domain Signal (dimension 1 X Observations)
%> @param N: N point DFT required
%>
%> @retval X: N - point Discrete Fourier Transform
%>
%>
% ==========================================================================
%> by Muhammad Salman Kabir <http://muhammad-salman-kabir.mystrikingly.com/>
% ==========================================================================
function X=DFT(signal,N)
[r,c]=size(signal);
X=0;
Y=0;
for k=1:N
for n=1:c
Y=Y+[signal(n)*exp((-j*2*pi*(k-1)*(n-1))/N)];
X(k)=Y;
end
Y=0;
end
disp("DFT of given sequence is: ");
disp(X');
end