%m源代码
function demo=fftdemo();
%FFT Discrete Fourier transform Demo.
% Luoyao 2-26-2006
% Revised N
% http://hi.baidu.com/geophysics
% geophysics_21@163.com
% Copyright 2006-2008 Luo Yao.
%
% FFT(X) is the discrete Fourier transform (DFT) of vector X. For
% matrices, the FFT operation is applied to each column. For N-D
% arrays, the FFT operation operates on the first non-singleton
% dimension.
%
% Type fftdemo with no input parameters for demo application
%
% If this code works, it was written only by Luo Yao.
% If not, I don't know who changed it.
%
% See also FFT, FT2, FFTN, FFTSHIFT, FFTW, IFFT, IFFT2, IFFTN.
% Copyright 2006-2008 Luo Yao.
% $Revision: 1.0 $ $Date: 2008-3-18 $
% Built-in function.
clear
clc
fs=5000
t=0:1/fs:0.6;
f1=100;
f2=300;
x=sin(2*pi*f1*t)+sin(2*pi*f2*t);
subplot(411)
plot(x);
xlim([0 200])
title('f1(100Hz)/f2(300Hz)的正弦信号,初相0')
xlabel('序列(n)')
grid on
number=1024*1
y=fft(x,number);
n=0:length(y)-1;
f=fs*n/length(y);
subplot(412)
plot(f(1:number/2),abs(y(1:number/2))/number);
xlim([0 1000])
title('f1/f2的正弦信号的FFT(1024点)')
xlabel('频率Hz')
grid on
demo=['fft demo by 骆遥'];
xr=x+randn(1,length(x));
subplot(413)
plot(x,'r')
hold on
plot(xr);
xlim([0 200])
title('原f1/f2的正弦信号(含随机噪声)')
xlabel('序列(n)')
grid on
yr=fft(xr,number);
n=0:length(y)-1;
f=fs*n/length(yr);
subplot(414)
plot(f(1:number/2),abs(yr(1:number/2))/number);
xlim([0 1000])
title('原f1/f2的正弦信号(含随机噪声)的FFT(1024点)')
xlabel('频率Hz')
grid on
end
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
给图片添加了正弦噪声,利用MATLAB源代码消除噪声.rar (8个子文件)
demofft2.m 328B
demodct.m 266B
fftdemo.m 2KB
example4.m 1KB
demomorg.m 431B
houghdemo.m 1KB
kjyr5.m 1KB
demokl.m 744B
共 8 条
- 1
资源评论
- m0_655814972023-11-30资源内容详细,总结地很全面,与描述的内容一致,对我启发很大,学习了。
- IanChan2022-11-13资源很不错,内容和描述一致,值得借鉴,赶紧学起来!
黑色的迷迭香
- 粉丝: 701
- 资源: 4万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功