|
这两天搞毕业设计,编的用Matlab中的fft分析含噪声的信号
其中有直接FFT,时域同步平均后FFT,频域同步平均后FFT。可以参考。
%%This procedure is to investigate the FFT of sine signal, sine signal with noise.
%%The sine signal with noise is treated by direct FFT,
%%FFT after piece-wise averaging in time domain, and FFT after
%%piece-wise averaging frequency domain
clear all; pack
w=10; t=0:(2*pi/w/500):(300*2*pi/w); x=sin(w*t); n=length(t);
ss=888; randn('seed',ss); z=randn(1,n);
z1=z-mean(z); z2=z1/max(abs(z1)); z2=z2*500;
figure(1); plot(t,x) % The sine signal without noise
fre=(1/(2*pi/w/500))*(1:n)/n; nn=fix(n/2); y1=fft(x); % The FFT of sine signal without noise
y1=(abs(y1)).^2/n; y2=y1(2:(nn+1)); fre1=2*pi*fre(1:nn);
figure(2)
[ 本帖最后由 ChaChing 于 2010-5-9 21:18 编辑 ] |
评分
-
1
查看全部评分
-
|