|
实际上可以不用滤波,可用改进周期图法,程序为:
x=load('data1.txt');
y=x(:,2);
fs=1000;
nfft=1024;
window=boxcar(length(y));
subplot 211;
periodogram(y,window,nfft,fs);
Ns= 256;
n=[0: Ns/2-1];
pxx1 =abs(fft(y(1:256), Ns).^2)/Ns;
pxx2=abs(fft(y(129:384), Ns).^2)/Ns;
pxx3=abs(fft(y(257:512), Ns).^2)/Ns;
pxx4=abs(fft(y(385:640), Ns).^2)/Ns;
pxxS=abs(fft(y(513:768), Ns).^2)/Ns;
pxx6=abs(fft(y(641:896), Ns).^2)/Ns;
pxx7=abs(fft(y(769:1001), Ns).^2)/Ns;
Pxx= 10 * log10((pxx1 +pxx2+pxx3+pxx4+pxxS+pxx6+pxx7)/7);
f = fs*n/Ns;
subplot 212; plot(f, Pxx(n+1));
xlabel (' Frequency' );
ylabel('PowerSpectrum (dB)');
title('Averaged Periodogram (halfovgrlap)');
grid;
其中把振动响应信号.txt改为名称data1.txt。得到的谱图如下。 |
-
周期图法和改进周期图法比较
|