Code RLS, Lms
Code RLS, Lms
Code RLS, Lms
XC d XC d
F- F-
uc
uc
PD
PD
!
!
W
W
t
t
O
O
N
N
y
y
bu
bu
X n hi u ch nghi Ch ng II
to
to
ww
ww
om
om
k
k
lic
lic
C
C
.c
.c
w
w
tr e tr re
ar
.
.
ac ac
k e r- s o ft w k e r- s o ft w a
66
h a n g e Pro h a n g e Pro
XC d XC d
F- F-
uc
uc
PD
PD
!
!
W
W
t
t
O
O
N
N
y
y
bu
bu
X n hi u ch nghi Ch ng II
to
to
ww
ww
om
om
k
k
lic
lic
C
C
.c
.c
w
w
tr e tr re
ar
.
.
ac ac
k e r- s o ft w k e r- s o ft w a
>> xlabel('Cac mau cua dap ung xung'); ylabel('Do lon'); grid on;
Error
0
-2
-4
0 50 100 150 200 250 300 350 400 450 500
Thoi gian
0.6
Dung
0.4 Uoc luong
Do lon
0.2
-0.2
0 5 10 15 20 25 30 35
Cac mau cua dap ung xung
N p 1 o n m thanh:
>> load mtlb;
L p l i 10 l n:
67
h a n g e Pro h a n g e Pro
XC d XC d
F- F-
uc
uc
PD
PD
!
!
W
W
t
t
O
O
N
N
y
y
bu
bu
X n hi u ch nghi Ch ng II
to
to
ww
ww
om
om
k
k
lic
lic
C
C
.c
.c
w
w
tr e tr re
ar
.
.
ac ac
k e r- s o ft w k e r- s o ft w a
>> s=repmat(mtlb,10,1);
V th :
>> subplot(3,1,1)
>> plot(s(1:length(mtlb)));title('Tin hieu goc');
Nghe n m thanh:
>> soundsc(s,Fs)
T o t p tr ng phn b chu n:
>> noise=randn(length(s),1);
T o nhi u 1:
>> noise1=filter([1 1],1,noise);
T o nhi u 2:
>> noise2=filter([1 -1],1,noise);
T o tn hi u c ng nhi u:
>> sn=s+noise1;
V th :
>> subplot(3,1,2);
>> plot(sn(1:length(mtlb)));title('Tin hieu+ nhieu');
Nghe n hi u l n nhi u:
>> soundsc(sn,Fs)
L y ra it ng l c thch nghi rls:
>> ha1=adaptfilt.rls(16)
ha1 =
Algorithm: 'Direct-Form FIR RLS Adaptive Filter'
FilterLength: 16
ForgettingFactor: 1
KalmanGain: [] ;
PersistentMemory: false
Ch n l c tn hi u nhi u v i thu t ton rls:
>> [y,e]=filter(ha1,noise2,sn);
68
h a n g e Pro h a n g e Pro
XC d XC d
F- F-
uc
uc
PD
PD
!
!
W
W
t
t
O
O
N
N
y
y
bu
bu
X n hi u ch nghi Ch ng II
to
to
ww
ww
om
om
k
k
lic
lic
C
C
.c
.c
w
w
tr e tr re
ar
.
.
ac ac
k e r- s o ft w k e r- s o ft w a
V c :
>> subplot(3,1,3);
>> plot(e(1:length(mtlb)));title('Loi = Tin hieu sau loc');
Nghe m thanh sau c:
>> soundsc(e,Fs)
c tnh xung ng v i tr ng thi sau cng c a b l c:
>> b=impz(ha1)
b= 0.8832 1.7683 1.6532 1.5340 1.4144 1.2986 1.1840 1.0682
0.9512 0.8344 0.7177 0.5988 0.4803 0.3628 0.2430 0.1211
-5
0 500 1000 1500 2000 2500 3000 3500 4000 4500
Tin hieu+ nhieu
10
-10
0 500 1000 1500 2000 2500 3000 3500 4000 4500
Loi = Tin hieu sau loc
5
-5
0 500 1000 1500 2000 2500 3000 3500 4000 4500
69
h a n g e Pro h a n g e Pro
XC d XC d
F- F-
uc
uc
PD
PD
!
!
W
W
t
t
O
O
N
N
y
y
bu
bu
X n hi u ch nghi Ch ng II
to
to
ww
ww
om
om
k
k
lic
lic
C
C
.c
.c
w
w
tr e tr re
ar
.
.
ac ac
k e r- s o ft w k e r- s o ft w a
-2
-4
0 100 200 300 400 500 600 700 800 900 1000
Tin hieu ra
4
-2
-4
0 100 200 300 400 500 600 700 800 900 1000
70