diff options
Diffstat (limited to 'adaptive/doc')
-rwxr-xr-x | adaptive/doc/lms2~-help.pd | 232 | ||||
-rwxr-xr-x | adaptive/doc/lms~-help.pd | 179 | ||||
-rwxr-xr-x | adaptive/doc/nlms2~-help.pd | 238 | ||||
-rwxr-xr-x | adaptive/doc/nlms~-help.pd | 186 |
4 files changed, 835 insertions, 0 deletions
diff --git a/adaptive/doc/lms2~-help.pd b/adaptive/doc/lms2~-help.pd new file mode 100755 index 0000000..6910a02 --- /dev/null +++ b/adaptive/doc/lms2~-help.pd @@ -0,0 +1,232 @@ +#N canvas 213 0 700 678 10; +#X floatatom 37 482 8 0 0 0 - - -; +#X obj 45 279 r message; +#N canvas 0 0 260 260 unsig~ 0; +#X obj 22 42 inlet~; +#X text 62 42 ~signal_in~; +#X obj 22 168 outlet; +#X text 69 169 float-out; +#X obj 22 142 snapshot~; +#X obj 39 119 metro 300; +#X obj 40 70 loadbang; +#X msg 40 95 1; +#X connect 0 0 4 0; +#X connect 4 0 2 0; +#X connect 5 0 4 0; +#X connect 6 0 7 0; +#X connect 7 0 5 0; +#X restore 37 460 pd unsig~; +#X text 89 219 input signal x[n]; +#X text 176 259 reference signal d[n]; +#X text 176 274 (desired signal); +#X text 108 461 output signal y[n]; +#X text 35 166 init arg1: nr. of coefficients; +#X text 35 179 init arg2: stepsize parameter mu; +#X text 198 641 (c) Georg Holzmann <grh@mur.at> \, 2005; +#X text 39 520 some more info:; +#X obj 219 24 cnv 15 258 58 empty empty empty 10 22 0 14 -1 -66577 +0; +#X obj 223 28 cnv 15 250 50 empty empty lms2~ 10 24 0 14 -228992 -1 +0; +#X text 350 38 adaptive systems; +#X text 360 54 for Pure Data; +#X text 35 599 in the example folder !; +#X text 35 586 For much more examples see patches; +#X obj 38 218 sig~ 2; +#X obj 124 258 sig~ 1; +#X text 85 134 outputs for e[n] and c[n]; +#X floatatom 82 434 8 0 0 0 - - -; +#N canvas 0 0 260 260 unsig~ 0; +#X obj 22 42 inlet~; +#X text 62 42 ~signal_in~; +#X obj 22 168 outlet; +#X text 69 169 float-out; +#X obj 22 142 snapshot~; +#X obj 39 119 metro 300; +#X obj 40 70 loadbang; +#X msg 40 95 1; +#X connect 0 0 4 0; +#X connect 4 0 2 0; +#X connect 5 0 4 0; +#X connect 6 0 7 0; +#X connect 7 0 5 0; +#X restore 82 412 pd unsig~; +#X text 153 413 error signal e[n]; +#X obj 123 343 unpack f f; +#X floatatom 123 383 5 0 0 0 - - -; +#X floatatom 188 366 5 0 0 0 - - -; +#X text 162 383 c0[n]; +#X text 230 366 c1[n]; +#X text 128 323 coefficients:; +#X text 36 122 lms2~: same as lms~ \, but with additional; +#X obj 37 304 lms2~ 2 1e-04; +#N canvas 347 29 502 634 LMS_EXPLANATION 0; +#X text 35 135 x[n] ... input signal of the system; +#X text 35 120 c[n] ... coefficient vector of the system; +#X text 35 104 y[n] ... output signal of the system; +#X text 43 369 d[n] ... desired signal \, reference signal; +#X text 50 74 -> y[n] = c0[n]*x[n] + c1[n]*x[n-1] + c2[n]*x[n-2] + +...; +#X text 32 195 The LMS Adaptation Algorithm:; +#X text 70 226 c[n] = c[n-1] + mu*e[n]*x[n]; +#X text 43 309 mu ... step-size parameter (learning rate); +#X text 42 279 c[n] ... new coefficient vector; +#X text 42 294 c[n-1] ... old coefficient vector; +#X text 42 325 e[n] ... error sample at time n \, LMS tries to minimize +this error; +#X text 43 353 x[n] ... tap-input vector at time n; +#X text 71 241 with e[n] = d[n] - y[n]; +#X text 33 33 An adaptive system is simply a FIR filter with the coefficients +c[n] \, which can be learned.; +#X text 104 485 0 < mu < 2/(abs(x[n])^2); +#X text 38 517 -> abs(x[n])^2 is the tap-input energy; +#X text 60 532 at time n (lenght of x[n] is PDs; +#X text 35 579 Note: this only ensures "stability on average"; +#X text 60 547 blocksize - so use block~ to change it!); +#X text 34 432 How to choose mu ?; +#X text 34 455 Sufficient (deterministic) stability condition:; +#X restore 38 561 pd LMS_EXPLANATION; +#N canvas 812 118 510 736 LMS2_EXAMPLE 0; +#X obj 31 109 sig~ 2; +#X obj 116 110 sig~ 1; +#X text 36 87 x[n]; +#X text 124 91 d[n]; +#X text 31 234 y[n]; +#X obj 40 159 r \$0-lms; +#X text 115 28 x[n] = 2 \, d[n] = 1 \, N = 1 (= nr. of coefficients) +; +#X text 26 29 EXAMPLE:; +#N canvas 0 0 450 300 graph3 0; +#X array x 1024 float 0; +#X array y 1024 float 0; +#X array d 1024 float 0; +#X coords 0 2 1023 0 400 140 1; +#X restore 51 302 graph; +#N canvas 422 247 876 321 plot_logic 0; +#X obj 37 162 tabwrite~ x; +#X obj 123 162 tabwrite~ y; +#X obj 209 162 tabwrite~ d; +#X obj 179 77 metro 100; +#X obj 179 26 loadbang; +#X msg 179 52 1; +#X obj 514 58 loadbang; +#X obj 37 136 r~ x_; +#X obj 123 136 r~ y_; +#X obj 209 136 r~ d_; +#X msg 505 153 \; x yticks 0 0.25 2; +#X msg 489 121 \; x xticks 0 32 2; +#X msg 646 150 \; x ylabel 1060 0 0.5 1 1.5 2; +#X msg 622 105 \; x xlabel -0.2 0 256 512 768 1024; +#X obj 296 102 r~ e_; +#X obj 297 161 tabwrite~ e; +#X obj 297 131 *~; +#X msg 498 224 \; e xticks 0 32 2; +#X msg 514 256 \; e yticks 0 0.25 2; +#X msg 631 208 \; e xlabel -0.2 0 256 512 768 1024; +#X msg 655 253 \; e ylabel 1060 0 0.5 1 1.5 2; +#X obj 541 198 loadbang; +#X connect 3 0 0 0; +#X connect 3 0 1 0; +#X connect 3 0 2 0; +#X connect 3 0 15 0; +#X connect 4 0 5 0; +#X connect 5 0 3 0; +#X connect 6 0 11 0; +#X connect 6 0 10 0; +#X connect 6 0 13 0; +#X connect 6 0 12 0; +#X connect 7 0 0 0; +#X connect 8 0 1 0; +#X connect 9 0 2 0; +#X connect 14 0 16 0; +#X connect 14 0 16 1; +#X connect 16 0 15 0; +#X connect 21 0 17 0; +#X connect 21 0 18 0; +#X connect 21 0 19 0; +#X connect 21 0 20 0; +#X restore 198 246 pd plot_logic; +#X obj 341 244 s \$0-lms; +#X msg 341 220 adaptation 1; +#X obj 341 199 loadbang; +#X obj 198 207 s \$0-lms; +#X msg 198 171 mu \$1; +#X floatatom 210 150 8 0 0 0 - - -; +#X text 275 147 <- try different mu; +#X msg 199 109 clear; +#X text 242 110 <- clear to start new adaptation; +#X text 189 461 -- 1024 samples --; +#X obj 37 131 s~ x_; +#X obj 125 132 s~ d_; +#X obj 31 213 s~ y_; +#X obj 74 213 s~ e_; +#N canvas 0 0 450 300 graph3 0; +#X array e 1024 float 0; +#X coords 0 2 1023 0 400 140 1; +#X restore 48 534 graph; +#X text 195 693 -- 1024 samples --; +#X text 47 510 squared error e^2[n] (learning curve):; +#X obj 30 181 lms2~ 1 1e-05; +#X connect 0 0 20 0; +#X connect 0 0 27 0; +#X connect 1 0 21 0; +#X connect 1 0 27 1; +#X connect 5 0 27 0; +#X connect 11 0 10 0; +#X connect 12 0 11 0; +#X connect 14 0 13 0; +#X connect 15 0 14 0; +#X connect 17 0 13 0; +#X connect 27 0 22 0; +#X connect 27 1 23 0; +#X restore 38 540 pd LMS2_EXAMPLE; +#X msg 384 373 getmu; +#X msg 384 352 mu \$1; +#X floatatom 392 333 8 0 0 0 - - -; +#X msg 384 408 getN; +#X msg 384 497 help; +#X msg 384 228 clear; +#X msg 384 295 print; +#X msg 384 465 read demo.dat; +#X msg 384 195 getadaptation; +#X obj 384 152 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X msg 384 173 adaptation \$1; +#X msg 384 444 write demo.dat; +#X obj 384 526 s message; +#X text 487 173 turn adaptation on/off; +#X text 432 222 clear current coefficients; +#X text 432 235 and set them back to 0; +#X text 433 294 print current coefficients; +#X text 435 356 set/get stepsize parameter; +#X text 436 370 mu (learning rate); +#X text 425 408 get Nr. of coefficients; +#X text 495 461 and mu to file; +#X text 495 447 write/read coefficients; +#X msg 384 264 init_unity; +#X text 464 251 set first coefficient to 1 \,; +#X text 466 264 all others to 0 (= delay; +#X text 465 277 free transmission); +#X connect 1 0 30 0; +#X connect 2 0 0 0; +#X connect 17 0 30 0; +#X connect 18 0 30 1; +#X connect 21 0 20 0; +#X connect 23 0 24 0; +#X connect 23 1 25 0; +#X connect 30 0 2 0; +#X connect 30 1 21 0; +#X connect 30 2 23 0; +#X connect 33 0 45 0; +#X connect 34 0 45 0; +#X connect 35 0 34 0; +#X connect 36 0 45 0; +#X connect 37 0 45 0; +#X connect 38 0 45 0; +#X connect 39 0 45 0; +#X connect 40 0 45 0; +#X connect 41 0 45 0; +#X connect 42 0 43 0; +#X connect 43 0 45 0; +#X connect 44 0 45 0; +#X connect 55 0 45 0; diff --git a/adaptive/doc/lms~-help.pd b/adaptive/doc/lms~-help.pd new file mode 100755 index 0000000..b16149e --- /dev/null +++ b/adaptive/doc/lms~-help.pd @@ -0,0 +1,179 @@ +#N canvas 148 190 700 570 10; +#X msg 395 341 getmu; +#X msg 395 320 mu \$1; +#X floatatom 403 301 8 0 0 0 - - -; +#X msg 395 376 getN; +#X msg 395 465 help; +#X msg 395 196 clear; +#X msg 395 263 print; +#X floatatom 37 365 8 0 0 0 - - -; +#X msg 395 433 read demo.dat; +#X msg 395 163 getadaptation; +#X obj 395 120 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X msg 395 141 adaptation \$1; +#X msg 395 412 write demo.dat; +#X text 36 122 LMS: least mean square adaptation algorithm; +#X obj 45 279 r message; +#X obj 395 494 s message; +#N canvas 0 0 260 260 unsig~ 0; +#X obj 22 42 inlet~; +#X text 62 42 ~signal_in~; +#X obj 22 168 outlet; +#X text 69 169 float-out; +#X obj 22 142 snapshot~; +#X obj 39 119 metro 300; +#X obj 40 70 loadbang; +#X msg 40 95 1; +#X connect 0 0 4 0; +#X connect 4 0 2 0; +#X connect 5 0 4 0; +#X connect 6 0 7 0; +#X connect 7 0 5 0; +#X restore 37 343 pd unsig~; +#X text 89 219 input signal x[n]; +#X text 169 248 reference signal d[n]; +#X text 169 263 (desired signal); +#X text 108 344 output signal y[n]; +#X obj 37 304 lms~ 2 1e-04; +#X text 35 160 init arg1: nr. of coefficients; +#X text 498 141 turn adaptation on/off; +#X text 443 190 clear current coefficients; +#X text 443 203 and set them back to 0; +#X text 444 262 print current coefficients; +#X text 35 173 init arg2: stepsize parameter mu; +#X text 446 324 set/get stepsize parameter; +#X text 447 338 mu (learning rate); +#X text 436 376 get Nr. of coefficients; +#X text 506 429 and mu to file; +#X text 506 415 write/read coefficients; +#X text 223 536 (c) Georg Holzmann <grh@mur.at> \, 2005; +#N canvas 347 29 502 634 LMS_EXPLANATION 0; +#X text 35 135 x[n] ... input signal of the system; +#X text 35 120 c[n] ... coefficient vector of the system; +#X text 35 104 y[n] ... output signal of the system; +#X text 43 369 d[n] ... desired signal \, reference signal; +#X text 50 74 -> y[n] = c0[n]*x[n] + c1[n]*x[n-1] + c2[n]*x[n-2] + +...; +#X text 32 195 The LMS Adaptation Algorithm:; +#X text 70 226 c[n] = c[n-1] + mu*e[n]*x[n]; +#X text 43 309 mu ... step-size parameter (learning rate); +#X text 42 279 c[n] ... new coefficient vector; +#X text 42 294 c[n-1] ... old coefficient vector; +#X text 42 325 e[n] ... error sample at time n \, LMS tries to minimize +this error; +#X text 43 353 x[n] ... tap-input vector at time n; +#X text 71 241 with e[n] = d[n] - y[n]; +#X text 33 33 An adaptive system is simply a FIR filter with the coefficients +c[n] \, which can be learned.; +#X text 104 485 0 < mu < 2/(abs(x[n])^2); +#X text 38 517 -> abs(x[n])^2 is the tap-input energy; +#X text 60 532 at time n (lenght of x[n] is PDs; +#X text 35 579 Note: this only ensures "stability on average"; +#X text 60 547 blocksize - so use block~ to change it!); +#X text 34 432 How to choose mu ?; +#X text 34 455 Sufficient (deterministic) stability condition:; +#X restore 38 429 pd LMS_EXPLANATION; +#X text 36 407 some more info:; +#N canvas 536 326 510 502 LMS_EXAMPLE 0; +#X obj 31 109 sig~ 2; +#X obj 108 109 sig~ 1; +#X text 36 87 x[n]; +#X text 116 90 d[n]; +#X text 31 234 y[n]; +#X obj 40 159 r \$0-lms; +#X text 115 28 x[n] = 2 \, d[n] = 1 \, N = 1 (= nr. of coefficients) +; +#X text 26 29 EXAMPLE:; +#N canvas 0 0 450 300 graph3 0; +#X array x 1024 float 0; +#X array y 1024 float 0; +#X array d 1024 float 0; +#X coords 0 2 1023 0 400 140 1; +#X restore 51 302 graph; +#N canvas 422 247 725 220 plot_logic 0; +#X obj 72 168 tabwrite~ x; +#X obj 158 168 tabwrite~ y; +#X obj 244 168 tabwrite~ d; +#X obj 191 105 metro 100; +#X obj 191 54 loadbang; +#X msg 191 80 1; +#X obj 386 57 loadbang; +#X obj 72 142 r~ x_; +#X obj 158 142 r~ y_; +#X obj 244 142 r~ d_; +#X msg 362 153 \; x yticks 0 0.25 2; +#X msg 346 121 \; x xticks 0 32 2; +#X msg 503 150 \; x ylabel 1060 0 0.5 1 1.5 2; +#X msg 479 105 \; x xlabel -0.2 0 256 512 768 1024; +#X connect 3 0 0 0; +#X connect 3 0 1 0; +#X connect 3 0 2 0; +#X connect 4 0 5 0; +#X connect 5 0 3 0; +#X connect 6 0 11 0; +#X connect 6 0 10 0; +#X connect 6 0 13 0; +#X connect 6 0 12 0; +#X connect 7 0 0 0; +#X connect 8 0 1 0; +#X connect 9 0 2 0; +#X restore 198 246 pd plot_logic; +#X obj 341 244 s \$0-lms; +#X msg 341 220 adaptation 1; +#X obj 341 199 loadbang; +#X obj 198 207 s \$0-lms; +#X msg 198 171 mu \$1; +#X floatatom 210 150 8 0 0 0 - - -; +#X text 275 147 <- try different mu; +#X msg 199 109 clear; +#X text 242 110 <- clear to start new adaptation; +#X obj 30 181 lms~ 1 1e-05; +#X text 189 461 -- 1024 samples --; +#X obj 37 131 s~ x_; +#X obj 117 131 s~ d_; +#X obj 31 213 s~ y_; +#X connect 0 0 19 0; +#X connect 0 0 21 0; +#X connect 1 0 19 1; +#X connect 1 0 22 0; +#X connect 5 0 19 0; +#X connect 11 0 10 0; +#X connect 12 0 11 0; +#X connect 14 0 13 0; +#X connect 15 0 14 0; +#X connect 17 0 13 0; +#X connect 19 0 23 0; +#X restore 38 451 pd LMS_EXAMPLE; +#X obj 219 24 cnv 15 258 58 empty empty empty 10 22 0 14 -1 -66577 +0; +#X obj 223 28 cnv 15 250 50 empty empty lms~ 10 24 0 14 -228992 -1 +0; +#X text 350 38 adaptive systems; +#X text 360 54 for Pure Data; +#X text 34 488 in the example folder !; +#X text 35 474 For much more examples see patches; +#X obj 38 218 sig~ 2; +#X obj 117 247 sig~ 1; +#X msg 395 232 init_unity; +#X text 475 219 set first coefficient to 1 \,; +#X text 477 232 all others to 0 (= delay; +#X text 476 245 free transmission); +#X connect 0 0 15 0; +#X connect 1 0 15 0; +#X connect 2 0 1 0; +#X connect 3 0 15 0; +#X connect 4 0 15 0; +#X connect 5 0 15 0; +#X connect 6 0 15 0; +#X connect 8 0 15 0; +#X connect 9 0 15 0; +#X connect 10 0 11 0; +#X connect 11 0 15 0; +#X connect 12 0 15 0; +#X connect 14 0 21 0; +#X connect 16 0 7 0; +#X connect 21 0 16 0; +#X connect 43 0 21 0; +#X connect 44 0 21 1; +#X connect 45 0 15 0; diff --git a/adaptive/doc/nlms2~-help.pd b/adaptive/doc/nlms2~-help.pd new file mode 100755 index 0000000..ea103ba --- /dev/null +++ b/adaptive/doc/nlms2~-help.pd @@ -0,0 +1,238 @@ +#N canvas 108 136 700 678 10; +#X floatatom 37 482 8 0 0 0 - - -; +#X obj 45 279 r message; +#N canvas 0 0 260 260 unsig~ 0; +#X obj 22 42 inlet~; +#X text 62 42 ~signal_in~; +#X obj 22 168 outlet; +#X text 69 169 float-out; +#X obj 22 142 snapshot~; +#X obj 39 119 metro 300; +#X obj 40 70 loadbang; +#X msg 40 95 1; +#X connect 0 0 4 0; +#X connect 4 0 2 0; +#X connect 5 0 4 0; +#X connect 6 0 7 0; +#X connect 7 0 5 0; +#X restore 37 460 pd unsig~; +#X text 89 219 input signal x[n]; +#X text 182 252 reference signal d[n]; +#X text 182 267 (desired signal); +#X text 108 461 output signal y[n]; +#X text 35 166 init arg1: nr. of coefficients; +#X text 35 179 init arg2: stepsize parameter mu; +#X text 221 646 (c) Georg Holzmann <grh@mur.at> \, 2005; +#X text 39 520 some more info:; +#X obj 219 24 cnv 15 258 58 empty empty empty 10 22 0 14 -1 -66577 +0; +#X obj 223 28 cnv 15 250 50 empty empty nlms2~ 10 24 0 14 -228992 -1 +0; +#X text 350 38 adaptive systems; +#X text 360 54 for Pure Data; +#X text 35 599 in the example folder !; +#X text 35 586 For much more examples see patches; +#X obj 38 218 sig~ 2; +#X obj 130 251 sig~ 1; +#X text 93 134 outputs for e[n] and c[n]; +#X floatatom 82 434 8 0 0 0 - - -; +#N canvas 0 0 260 260 unsig~ 0; +#X obj 22 42 inlet~; +#X text 62 42 ~signal_in~; +#X obj 22 168 outlet; +#X text 69 169 float-out; +#X obj 22 142 snapshot~; +#X obj 39 119 metro 300; +#X obj 40 70 loadbang; +#X msg 40 95 1; +#X connect 0 0 4 0; +#X connect 4 0 2 0; +#X connect 5 0 4 0; +#X connect 6 0 7 0; +#X connect 7 0 5 0; +#X restore 82 412 pd unsig~; +#X text 153 413 error signal e[n]; +#X obj 130 342 unpack f f; +#X floatatom 130 382 5 0 0 0 - - -; +#X floatatom 195 365 5 0 0 0 - - -; +#X text 169 382 c0[n]; +#X text 237 365 c1[n]; +#X text 135 322 coefficients:; +#X text 36 122 nlms2~: same as nlms~ \, but with additional; +#X obj 37 304 nlms2~ 2 0.001; +#N canvas 812 118 510 736 NLMS2_EXAMPLE 0; +#X obj 31 109 sig~ 2; +#X obj 123 108 sig~ 1; +#X text 36 87 x[n]; +#X text 131 89 d[n]; +#X text 31 234 y[n]; +#X obj 40 159 r \$0-lms; +#X text 115 28 x[n] = 2 \, d[n] = 1 \, N = 1 (= nr. of coefficients) +; +#X text 26 29 EXAMPLE:; +#N canvas 0 0 450 300 graph3 0; +#X array x 1024 float 0; +#X array y 1024 float 0; +#X array d 1024 float 0; +#X coords 0 2 1023 0 400 140 1; +#X restore 51 302 graph; +#N canvas 422 247 876 321 plot_logic 0; +#X obj 37 162 tabwrite~ x; +#X obj 123 162 tabwrite~ y; +#X obj 209 162 tabwrite~ d; +#X obj 179 77 metro 100; +#X obj 179 26 loadbang; +#X msg 179 52 1; +#X obj 514 58 loadbang; +#X obj 37 136 r~ x_; +#X obj 123 136 r~ y_; +#X obj 209 136 r~ d_; +#X msg 505 153 \; x yticks 0 0.25 2; +#X msg 489 121 \; x xticks 0 32 2; +#X msg 646 150 \; x ylabel 1060 0 0.5 1 1.5 2; +#X msg 622 105 \; x xlabel -0.2 0 256 512 768 1024; +#X obj 296 102 r~ e_; +#X obj 297 161 tabwrite~ e; +#X obj 297 131 *~; +#X msg 498 224 \; e xticks 0 32 2; +#X msg 514 256 \; e yticks 0 0.25 2; +#X msg 631 208 \; e xlabel -0.2 0 256 512 768 1024; +#X msg 655 253 \; e ylabel 1060 0 0.5 1 1.5 2; +#X obj 541 198 loadbang; +#X connect 3 0 0 0; +#X connect 3 0 1 0; +#X connect 3 0 2 0; +#X connect 3 0 15 0; +#X connect 4 0 5 0; +#X connect 5 0 3 0; +#X connect 6 0 11 0; +#X connect 6 0 10 0; +#X connect 6 0 13 0; +#X connect 6 0 12 0; +#X connect 7 0 0 0; +#X connect 8 0 1 0; +#X connect 9 0 2 0; +#X connect 14 0 16 0; +#X connect 14 0 16 1; +#X connect 16 0 15 0; +#X connect 21 0 17 0; +#X connect 21 0 18 0; +#X connect 21 0 19 0; +#X connect 21 0 20 0; +#X restore 198 246 pd plot_logic; +#X obj 341 244 s \$0-lms; +#X msg 341 220 adaptation 1; +#X obj 341 199 loadbang; +#X obj 198 207 s \$0-lms; +#X msg 198 171 mu \$1; +#X floatatom 210 150 8 0 0 0 - - -; +#X text 275 147 <- try different mu; +#X msg 199 109 clear; +#X text 242 110 <- clear to start new adaptation; +#X text 189 461 -- 1024 samples --; +#X obj 37 131 s~ x_; +#X obj 132 130 s~ d_; +#X obj 31 213 s~ y_; +#X obj 76 213 s~ e_; +#N canvas 0 0 450 300 graph3 0; +#X array e 1024 float 0; +#X coords 0 2 1023 0 400 140 1; +#X restore 48 534 graph; +#X text 195 693 -- 1024 samples --; +#X text 47 510 squared error e^2[n] (learning curve):; +#X obj 30 181 nlms2~ 1 0.001; +#X connect 0 0 20 0; +#X connect 0 0 27 0; +#X connect 1 0 21 0; +#X connect 1 0 27 1; +#X connect 5 0 27 0; +#X connect 11 0 10 0; +#X connect 12 0 11 0; +#X connect 14 0 13 0; +#X connect 15 0 14 0; +#X connect 17 0 13 0; +#X connect 27 0 22 0; +#X connect 27 1 23 0; +#X restore 38 540 pd NLMS2_EXAMPLE; +#N canvas 347 29 502 539 NLMS_EXPLANATION 0; +#X text 35 135 x[n] ... input signal of the system; +#X text 35 120 c[n] ... coefficient vector of the system; +#X text 35 104 y[n] ... output signal of the system; +#X text 35 398 d[n] ... desired signal \, reference signal; +#X text 50 74 -> y[n] = c0[n]*x[n] + c1[n]*x[n-1] + c2[n]*x[n-2] + +...; +#X text 35 312 mu ... step-size parameter (learning rate); +#X text 34 282 c[n] ... new coefficient vector; +#X text 34 297 c[n-1] ... old coefficient vector; +#X text 34 354 e[n] ... error sample at time n \, LMS tries to minimize +this error; +#X text 35 382 x[n] ... tap-input vector at time n; +#X text 71 241 with e[n] = d[n] - y[n]; +#X text 33 33 An adaptive system is simply a FIR filter with the coefficients +c[n] \, which can be learned.; +#X text 36 440 How to choose mu ?; +#X text 36 463 Sufficient (deterministic) stability condition:; +#X text 32 195 The normalized LMS Adaptation Algorithm:; +#X text 70 226 c[n] = c[n-1] + mu/(alpha+abs(x[n])^2) *e[n]*x[n]; +#X text 34 327 alpha ... a small positive constant \, only to avoid +division by zero; +#X text 152 490 0 < mu < 2; +#X restore 38 561 pd NLMS_EXPLANATION; +#X msg 387 352 getmu; +#X msg 387 331 mu \$1; +#X floatatom 395 312 8 0 0 0 - - -; +#X msg 387 460 getN; +#X msg 387 549 help; +#X msg 387 209 clear; +#X msg 387 276 print; +#X msg 387 517 read demo.dat; +#X msg 387 173 getadaptation; +#X obj 387 130 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X msg 387 151 adaptation \$1; +#X msg 387 496 write demo.dat; +#X obj 387 578 s message; +#X text 490 151 turn adaptation on/off; +#X text 435 203 clear current coefficients; +#X text 435 216 and set them back to 0; +#X text 436 275 print current coefficients; +#X text 438 335 set/get stepsize parameter; +#X text 439 349 mu (learning rate); +#X text 428 460 get Nr. of coefficients; +#X text 498 513 and mu to file; +#X text 498 499 write/read coefficients; +#X floatatom 395 382 8 0 0 0 - - -; +#X msg 387 401 alpha \$1; +#X msg 387 422 getalpha; +#X text 456 403 set/get alpha (normally; +#X text 457 417 you don't need that); +#X msg 387 246 init_unity; +#X text 467 233 set first coefficient to 1 \,; +#X text 469 246 all others to 0 (= delay; +#X text 468 259 free transmission); +#X connect 1 0 30 0; +#X connect 2 0 0 0; +#X connect 17 0 30 0; +#X connect 18 0 30 1; +#X connect 21 0 20 0; +#X connect 23 0 24 0; +#X connect 23 1 25 0; +#X connect 30 0 2 0; +#X connect 30 1 21 0; +#X connect 30 2 23 0; +#X connect 33 0 45 0; +#X connect 34 0 45 0; +#X connect 35 0 34 0; +#X connect 36 0 45 0; +#X connect 37 0 45 0; +#X connect 38 0 45 0; +#X connect 39 0 45 0; +#X connect 40 0 45 0; +#X connect 41 0 45 0; +#X connect 42 0 43 0; +#X connect 43 0 45 0; +#X connect 44 0 45 0; +#X connect 55 0 56 0; +#X connect 56 0 45 0; +#X connect 57 0 45 0; +#X connect 60 0 45 0; diff --git a/adaptive/doc/nlms~-help.pd b/adaptive/doc/nlms~-help.pd new file mode 100755 index 0000000..d58ef68 --- /dev/null +++ b/adaptive/doc/nlms~-help.pd @@ -0,0 +1,186 @@ +#N canvas 0 0 700 667 10; +#X msg 395 342 getmu; +#X msg 395 321 mu \$1; +#X floatatom 403 302 8 0 0 0 - - -; +#X msg 395 450 getN; +#X msg 395 539 help; +#X msg 395 199 clear; +#X msg 395 266 print; +#X floatatom 37 406 8 0 0 0 - - -; +#X msg 395 507 read demo.dat; +#X msg 395 163 getadaptation; +#X obj 395 120 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0 +1; +#X msg 395 141 adaptation \$1; +#X msg 395 486 write demo.dat; +#X obj 45 320 r message; +#X obj 395 568 s message; +#N canvas 0 0 260 260 unsig~ 0; +#X obj 22 42 inlet~; +#X text 62 42 ~signal_in~; +#X obj 22 168 outlet; +#X text 69 169 float-out; +#X obj 22 142 snapshot~; +#X obj 39 119 metro 300; +#X obj 40 70 loadbang; +#X msg 40 95 1; +#X connect 0 0 4 0; +#X connect 4 0 2 0; +#X connect 5 0 4 0; +#X connect 6 0 7 0; +#X connect 7 0 5 0; +#X restore 37 384 pd unsig~; +#X text 89 260 input signal x[n]; +#X text 177 287 reference signal d[n]; +#X text 177 302 (desired signal); +#X text 108 385 output signal y[n]; +#X text 35 172 init arg1: nr. of coefficients; +#X text 498 141 turn adaptation on/off; +#X text 443 193 clear current coefficients; +#X text 443 206 and set them back to 0; +#X text 444 265 print current coefficients; +#X text 35 185 init arg2: stepsize parameter mu; +#X text 446 325 set/get stepsize parameter; +#X text 447 339 mu (learning rate); +#X text 436 450 get Nr. of coefficients; +#X text 506 503 and mu to file; +#X text 506 489 write/read coefficients; +#X text 206 622 (c) Georg Holzmann <grh@mur.at> \, 2005; +#X text 36 481 some more info:; +#X obj 219 24 cnv 15 258 58 empty empty empty 10 22 0 14 -1 -66577 +0; +#X obj 223 28 cnv 15 250 50 empty empty nlms~ 10 24 0 14 -228992 -1 +0; +#X text 350 38 adaptive systems; +#X text 360 54 for Pure Data; +#X text 34 562 in the example folder !; +#X text 35 548 For much more examples see patches; +#X obj 38 259 sig~ 2; +#X obj 125 286 sig~ 1; +#X text 36 134 Normalized LMS: normalized least mean square; +#X text 146 147 adaptation algorithm; +#N canvas 347 29 502 539 NLMS_EXPLANATION 0; +#X text 35 135 x[n] ... input signal of the system; +#X text 35 120 c[n] ... coefficient vector of the system; +#X text 35 104 y[n] ... output signal of the system; +#X text 35 398 d[n] ... desired signal \, reference signal; +#X text 50 74 -> y[n] = c0[n]*x[n] + c1[n]*x[n-1] + c2[n]*x[n-2] + +...; +#X text 35 312 mu ... step-size parameter (learning rate); +#X text 34 282 c[n] ... new coefficient vector; +#X text 34 297 c[n-1] ... old coefficient vector; +#X text 34 354 e[n] ... error sample at time n \, LMS tries to minimize +this error; +#X text 35 382 x[n] ... tap-input vector at time n; +#X text 71 241 with e[n] = d[n] - y[n]; +#X text 33 33 An adaptive system is simply a FIR filter with the coefficients +c[n] \, which can be learned.; +#X text 36 440 How to choose mu ?; +#X text 36 463 Sufficient (deterministic) stability condition:; +#X text 32 195 The normalized LMS Adaptation Algorithm:; +#X text 70 226 c[n] = c[n-1] + mu/(alpha+abs(x[n])^2) *e[n]*x[n]; +#X text 34 327 alpha ... a small positive constant \, only to avoid +division by zero; +#X text 152 490 0 < mu < 2; +#X restore 38 503 pd NLMS_EXPLANATION; +#N canvas 536 326 510 502 NLMS_EXAMPLE 0; +#X obj 31 109 sig~ 2; +#X obj 116 111 sig~ 1; +#X text 36 87 x[n]; +#X text 124 92 d[n]; +#X text 31 234 y[n]; +#X text 115 28 x[n] = 2 \, d[n] = 1 \, N = 1 (= nr. of coefficients) +; +#X text 26 29 EXAMPLE:; +#N canvas 0 0 450 300 graph3 0; +#X array x 1024 float 0; +#X array y 1024 float 0; +#X array d 1024 float 0; +#X coords 0 2 1023 0 400 140 1; +#X restore 51 302 graph; +#N canvas 422 247 725 220 plot_logic 0; +#X obj 72 168 tabwrite~ x; +#X obj 158 168 tabwrite~ y; +#X obj 244 168 tabwrite~ d; +#X obj 191 105 metro 100; +#X obj 191 54 loadbang; +#X msg 191 80 1; +#X obj 386 57 loadbang; +#X obj 72 142 r~ x_; +#X obj 158 142 r~ y_; +#X obj 244 142 r~ d_; +#X msg 362 153 \; x yticks 0 0.25 2; +#X msg 346 121 \; x xticks 0 32 2; +#X msg 503 150 \; x ylabel 1060 0 0.5 1 1.5 2; +#X msg 479 105 \; x xlabel -0.2 0 256 512 768 1024; +#X connect 3 0 0 0; +#X connect 3 0 1 0; +#X connect 3 0 2 0; +#X connect 4 0 5 0; +#X connect 5 0 3 0; +#X connect 6 0 11 0; +#X connect 6 0 10 0; +#X connect 6 0 13 0; +#X connect 6 0 12 0; +#X connect 7 0 0 0; +#X connect 8 0 1 0; +#X connect 9 0 2 0; +#X restore 198 246 pd plot_logic; +#X msg 341 220 adaptation 1; +#X obj 341 199 loadbang; +#X msg 198 171 mu \$1; +#X floatatom 210 150 8 0 0 0 - - -; +#X text 275 147 <- try different mu; +#X msg 199 109 clear; +#X text 242 110 <- clear to start new adaptation; +#X text 189 461 -- 1024 samples --; +#X obj 37 131 s~ x_; +#X obj 125 133 s~ d_; +#X obj 31 213 s~ y_; +#X obj 40 159 r \$0-nlms; +#X obj 198 207 s \$0-nlms; +#X obj 341 244 s \$0-nlms; +#X obj 30 181 nlms~ 1 0.001; +#X connect 0 0 17 0; +#X connect 0 0 23 0; +#X connect 1 0 18 0; +#X connect 1 0 23 1; +#X connect 9 0 22 0; +#X connect 10 0 9 0; +#X connect 11 0 21 0; +#X connect 12 0 11 0; +#X connect 14 0 21 0; +#X connect 20 0 23 0; +#X connect 23 0 19 0; +#X restore 38 525 pd NLMS_EXAMPLE; +#X floatatom 403 372 8 0 0 0 - - -; +#X msg 395 391 alpha \$1; +#X msg 395 412 getalpha; +#X text 464 393 set/get alpha (normally; +#X text 465 407 you don't need that); +#X obj 38 345 nlms~ 2 0.001; +#X msg 395 236 init_unity; +#X text 475 223 set first coefficient to 1 \,; +#X text 477 236 all others to 0 (= delay; +#X text 476 249 free transmission); +#X connect 0 0 14 0; +#X connect 1 0 14 0; +#X connect 2 0 1 0; +#X connect 3 0 14 0; +#X connect 4 0 14 0; +#X connect 5 0 14 0; +#X connect 6 0 14 0; +#X connect 8 0 14 0; +#X connect 9 0 14 0; +#X connect 10 0 11 0; +#X connect 11 0 14 0; +#X connect 12 0 14 0; +#X connect 13 0 50 0; +#X connect 15 0 7 0; +#X connect 39 0 50 0; +#X connect 40 0 50 1; +#X connect 45 0 46 0; +#X connect 46 0 14 0; +#X connect 47 0 14 0; +#X connect 50 0 15 0; +#X connect 51 0 14 0; |