fft.m

来自「用MATLAB实现快速傅里叶变换。方程有需要的话」· M 代码 · 共 15 行

M
15
字号
 t=-1:0.01:1;
 x=0.7*sin(2*pi*50*t)+sin(2*pi*120*t);
 y=x+randn(size(t));
 N=length(x);
 df=100/N;
 n=0:N/2;
 f=n*df;
 fx=fft(x);
 fy=fft(y);
 figure(1)
 subplot(211);plot(t,x);grid;
 subplot(212);plot(f,abs(fx(n+1)*2/N));grid;
 figure(2)
 subplot(211);plot(t,y);grid;
 subplot(212);plot(f,abs(fy(n+1))*2/N);grid;

⌨️ 快捷键说明

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