⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dft2.m

📁 数字信号处理(西安电子科技大学出版社)实验一的程序
💻 M
字号:
function [c,l]=DFT1(x,N,str)

%generation a function with following uses:
%compute dft;output the amplitude and angle of sample signal in frequency field;
%plot the digital signal in both time and frequency fields
%str:sample frequence
%x:sampled signal
%N:length of signal x
%c:dft signal
%l:angle frequency

n=0:N-1;
k=-200:200;
w=(pi/100)*k;
l=w;
c=x*(exp(-j*pi/100).^(n'*k));       %计算DFT[x(n)]
magX=abs(c);                        %The Ampalitatude
angX=angle(c);                      %The Angle
ymax=max(magX)
ymin=min(magX)

subplot(2,2,1);
t=max(x);
n=0:N-1;
stem(n,x,'.');
xlabel('n');
ylabel('xa(n)');
title('信号的原形');
text((0.3*N),(0.8*t),str);
hold on
n=0:N-1;
m=zeros(N);
plot(n,m);

subplot(2,2,3);
plot(w/pi,magX);
axis([-2 2 0 2]);
xlabel('w/pi');
ylabel('|Y(jw)|');
title('上图信号的傅式变换(|jw|)');

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -