Create your Gitee Account
Explore and code with more than 5 million developers,Free private repositories !:)
Sign up
Clone or download
demo.m 794 Bytes
Copy Edit Web IDE Raw Blame History
Vuko_wxh authored 2020-10-15 16:05 . update README.md
clf;fs=10240; %采样频率
Ndata=1024; %数据长度
N=1024; %FFT的数据长度
n=0:Ndata-1;
t=n/fs; %数据对应的时间序列
x=0.5*sin(2*pi*1000*t)+1; %时间域信号
subplot(2,2,4),plot(t,x);
subplot(2,2,2),plot(t,x,'.--');
y=fft(x,N); %信号的Fourier变换
mag=abs(y); %求取振幅
f=(0:N-1)*fs/N; %真实频率
subplot(2,2,1),plot(f(1:N/2),mag(1:N/2)*2/N); %绘出Nyquist频率之前的振幅
xlabel('频率/Hz');ylabel('振幅');
title('Ndata=10240 Nfft=1024');grid on;
k=0.8579/(0.3684+0.8579);
A = (pi * 0.3684 * k) / sin(pi * k);
tt=0:21-1;
xx=[ 0.045117 0.103931 0.629224 1.402661 2.148706 2.570068 2.581348 2.117285 1.377686 0.599414 0.089429 0.029004 0.447949 1.183521 1.963403 2.496753 2.615991 2.246192 1.537207 0.748462 0.157910];
subplot(2,2,3),plot(tt,xx); %绘出Nyquist频率之前的振幅

Comment ( 0 )

Sign in for post a comment