Reconstruct a sequence from its DTFT

1 次查看(过去 30 天)
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 个)

Shubham Khatri
Shubham Khatri 2020-11-10
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

类别

Help CenterFile Exchange 中查找有关 Time Series 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by