function filter
%filter noise
%original author: SD
%modified by Robin@Saturday, December 09, 2006, HK
N=4096;
M=N;
fout=fopen('1_f.txt','w');
x=xlsread('1.xls');
x2=x;
t=1:1:N;
for i=1:N
x(i)=x2(i);
end
%plot(t,x);
wn=100/1250;
%wn=[100/1250 140/1250]
[b,a]=butter(5,wn);
y=filtfilt(b,a,x);
for i=1:1:N
t(i)=i/2500;
end
for i=1:1:M
f(i)=i*2500/N;
end
fx=fft(x2,M);
fy=fft(y,M);
subplot(2,1,1);
plot(t,x);
tt=0:0.01:0.8;
for i=1:1:N
yy(i)=y(1+(i-1));
fprintf(fout,'%12.9f \n',yy(i));
end
subplot(2,1,2);
hold on;
plot(t,y,'r');
fclose(fout);
%axis([0,0.3,-10,80])
GMT+8, 2024-11-28 15:38 , Processed in 0.052812 second(s), 15 queries , Gzip On.
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.