?? ourpro1.m
字號:
clear all;
Fs = 1000;
N = 1000;
i = [0 : N-1]';
p=0.5*ecg(250).';
p1=[p;p;p;p];
p2=ecg(500).';
p3=[p2;p2];
figure;
subplot(311) ;plot(p3);
title('MATERNAL ECG SIGNAL');
x =p1+p3;
subplot(312) ;plot(x);
title('COMPOSITE SIGNAL');
y=x+sin(2*pi*60* i/Fs)
subplot(313);plot(y);
title('COMPOSITE SIGNAL WITH NOISE');
%create the reference signal of the adaptive filter
u =sin(2*pi*60* i/Fs);% sin(2*pi*60* i/Fs);
%adaptive filter architecture
L = 20;
step_size = 0.005;
w = zeros(1,L);
%run the adaptive filter
e(L) = x(L);
for k = L : N
regressor = flipud(u(k-L+ 1:k));
w = w + step_size * regressor' * e(k);
e(k+1) = y(k) - w * regressor;
end
%compute the spectrum of the initial signal and the filtered signal
f = [0 : Fs/N : Fs - Fs/N]';
F = abs(fft(y));
E = abs(fft(e));
%plot
figure;
subplot(211) ;plot(y); title(' COMPOSITE SIGNAL WITH NOISE');
subplot(212) ;plot(e); title('COMPOSITE SIGNAL AFTER FILTERING');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -