|
楼主 |
发表于 2006-11-23 17:27
|
显示全部楼层
%extract the periodic signal
clear
clc
%load the arbitrary signal data11 and the periodic signal data11sin.
wsize1=256;
wsize2=512;
load signal1.txt
%signal=awgn(signal1,10).';
signal=zeros(75000,2);
signal=signal1(5000:80000,1:2);
%load signalsin.txt
%xx=signalsin(:,2);
H1=zeros(wsize2,1);
H2=zeros(wsize2,1);
HH=zeros(wsize2,1);
size=1249;
for ii=1:size
xx1=signal(ii*20:ii*20+wsize1-1,2);
xx2=signal(10000+ii*20:ii*20+10000+wsize1-1,2);
h1=parzenwin(wsize1);
x1=xx1.*h1;
x2=xx2.*h1;
xkd=fft(x1,wsize2);
xk=fft(x2,wsize2);
for jj=1:wsize2
H1(jj)=xkd(jj)*conj(xk(jj))+H1(jj);
H2(jj)=xkd(jj)*conj(xkd(jj))+H2(jj);
end
end
for ii=1:wsize2
HH(ii)=H1(ii)/H2(ii);
end
%figure(1);
ifftHH=ifft(HH);
bn=ifftHH;
%subplot(211);
%plot(abs(HH));
%subplot(212);
%plot(abs(bn));
h2=boxcar(wsize2-1);
bm=bn(1:wsize2-1).*h2;
b=real(bm.');
%figure(2);
%subplot(211);
%plot(abs(b));
a=1;
X=signal(:,2);
y=filtfilt(b,a,X);
figure(3);
subplot(211),
plot(X(24000:28000)),xlabel('sampling'),ylabel('displacement'),
title('original signal');
%axis([ 0 80000 -0.001 0.001]),
subplot(212),
plot(real(y(24000:28000))),xlabel('sampling'),ylabel('displacement'),
title('extracted signal');
呵呵 这是俺的程序
俺的信号是一正弦加冲击振动响应信号
对信号不是很懂
请高手指点
谢谢 谢谢 相当的谢谢 |
|