matlab fft傅里叶变换

在这里插入图片描述

plot()用来绘制连续图像
stem()用来绘制散点图
subplot()设置子图的位置

Fs=64; T=1/Fs; 
N=16;n=0:N-1; 
nT = n*T;
x6n=cos(8*pi*nT)+cos(16*pi*nT)+cos(20*pi*nT)
X6k16=fft(x6n,16);
N=16;
f=2/N*(0:N-1);
figure(4);
 
xx6 = 0:0.02*pi/20:0.3*pi
yy6 = cos(8*pi*xx6)+cos(16*pi*xx6)+cos(20*pi*xx6)
 
subplot(2,2,1);
plot(xx6,yy6); 
title('x_6(n)');xlabel('xx');ylabel('幅度');
 
subplot(2,2,2);stem(f,abs(X6k16),'.'); 
title('x_6(n) 16');xlabel('ω/π');ylabel('幅度');
N=32;n=0:N-1; 
nT = n*T;
x6n=cos(8*pi*nT)+cos(16*pi*nT)+cos(20*pi*nT)
X6k32=fft(x6n,32);
N=32;
f=2/N*(0:N-1);
subplot(2,2,3);stem(f,abs(X6k32),'.'); 
title(' x_6(n) 32');xlabel('ω/π');ylabel('幅度');
N=64;n=0:N-1; 
nT = n*T;
x6n=cos(8*pi*nT)+cos(16*pi*nT)+cos(20*pi*nT)
X6k64=fft(x6n,64);
N=64;
f=2/N*(0:N-1);
subplot(2,2,4);stem(f,abs(X6k64),'.'); 
title(' x_6(n) 64 ');xlabel('ω/π');ylabel('幅度');

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值