码迷,mamicode.com
首页 > 其他好文 > 详细

matlab fft demo

时间:2015-05-09 10:10:14      阅读:113      评论:0      收藏:0      [点我收藏+]

标签:

clf;
fs=32;N=1024;   %采样频率和数据点数
n=0:N-1;
t=n/fs;   %时间序列
x=1*sin(t); %信号
y=fft(x,N);    %对信号进行快速Fourier变换
mag=abs(y);     %求得Fourier变换后的振幅
f=n*fs/N;    %频率序列
subplot(2,1,1),plot(t, x);   %绘出随频率变化的振幅
xlabel(‘频率/Hz‘);
ylabel(‘振幅‘);title(‘N=128‘);grid on;
subplot(2,1,2),plot(f(1:N/2),mag(1:N/2)); %绘出Nyquist频率之前随频率变化的振幅
xlabel(‘频率/Hz‘);
ylabel(‘振幅‘);title(‘N=128‘);grid on;

matlab fft demo

标签:

原文地址:http://www.cnblogs.com/zhang-pengcheng/p/4489349.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!