自学内容网 自学内容网

利用DFT画有限长序列的DTFT

MATLAB中没有DTFT函数,计算机不可能给出连续结果,可以只能利用DFT的fft函数来实现。
在这里插入图片描述

在这里插入图片描述

%%
L = 7;
x = ones(1, L)
figure; tiledlayout(2,3,"TileSpacing","tight")
nexttile; stem([0:L-1],x)
box off
title([num2str(L),' points rectangular pulse'])
axis tight
%%
X = fft(x);
nexttile; plot([0:L-1],abs(X),'o-')
box off
title([num2str(L),' points DFT'])
axis tight
%%


N = 256;
X = fft(x, N);
nexttile; plot([0:N-1],abs(X),'.')
title('256 points DFT')

box off
axis tight
%%
nexttile; plot([0:N-1],abs(fftshift(X)),'.')
title('256 points zero-centered DFT')
box off
axis tight

%%
w = 2*pi * (0:(N-1)) / N;


w2 = fftshift(w);
% plot(w2)

w3 = unwrap(w2 - 2*pi);
% plot(w3)
nexttile; plot(w3, abs(fftshift(X)))
axis tight
xlim([-pi, pi])
xticks([-pi:pi:pi])
xticklabels({'-\pi',0,'\pi'})
xlabel('radians')
title('plot DTFT the normalized angular frequency')
box off


%%
nexttile; plot(w3/pi, abs(fftshift(X)))
axis tight
xlim([-1, 1])
xlabel('radians / \pi')
title('plot DTFT using normalized frequency')

box off

unwarp函数
在这里插入图片描述


原文地址:https://blog.csdn.net/u013600306/article/details/144446951

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!