Reconstruct a sequence from its DTFT
Afficher commentaires plus anciens
I have a sequence x and i have found its DTFT. Now i am trying to reconstruct the sequence x from its DTFT. Can someone help me with this? Thanks
1 commentaire
Matt J
le 1 Nov 2020
Wy not just use the known formula for the IDTFT?
Réponses (1)
Shubham Khatri
le 10 Nov 2020
Hi , please take a look at the following code for calculating the iDTFT. It first calculates the DTFT followed by IDTFT.
W = 2; %angular freq
Fs = 100; % frequency meant to replicate continuous data
t = 0:1/Fs:W-1/Fs; %time
N = length(t);
x = cos(2*pi*t);
% Sampled x
fs = 20; % sampling frequency
Ts = 1/fs;
num = W*fs; % # of (discrete) samples to get
n = 0:num-1;
xn = cos(2*pi*n*Ts);
% Discrete Time Fourier Transform
f2 = -10:1/Fs:10;
Xs = zeros(1,length(f2));
for i1 = 1:length(f2)
s = 0;
for i2 = 1:length(n)
s = s + xn(i2)*exp(-1i*f2(i1)*i2)
end
Xs(i1) = s
end
% Inverse Discrete Time Fourier Transform
n2 = 0:length(n)-1;
xsr = zeros(1,length(n2));
range = 0:1/Fs:2*pi-1/Fs;
for i1 = 1:length(n2)
s = 0;
for i2 = (1:length(range))+floor(length(f2)/2)
s = s + Xs(i2)*exp(1i*f2(i2)*i1);
end
xsr(i1) = s/2/pi/Fs; % divide by Fs to replciate infintesimaly small dt
end
Catégories
En savoir plus sur Special Functions dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!