clc;
clear all;
close all;
Fs=128;
Fp1=2;
Fc1=0.5;
Fp2=63;
Fc2=64;
kind='bandpass';
L=5000;
t=(0:L-1)/Fs;
x =4*rand(1)*sin(2*pi*50*rand(1)*t)+2*rand(size(t));
x1=4*sin(2*pi*10000*t)+2*rand(size(t));
for i=0:30
x1 = x1+4*rand(1)*sin(2*pi*50*rand(1)*t);
end
figure;
subplot(2,1,1);
plot(t,x);
ylabel('幅值/uA');xlabel('时间');title('信号x时域波形')
subplot(2,1,2);
plot(t,x1);
ylabel('幅值/uA');xlabel('时间');title('信号x1时域波形')
%filter
hn=Hann_filter(Fp1,Fc1,Fp2,Fc2,Fs,kind);%自编汉宁窗函数,此处用的是带通,2-63Hz
X=filtfilt(hn,1,x);
X1=filtfilt(hn,1,x1);
figure;
subplot(2,1,1);
plot(t,X);</