#N canvas 0 276 944 596 10;
#X declare -path ..;
#N canvas 10 567 633 314 unknown_system~ 0;
#X obj 26 26 inlet~;
#X obj 26 268 outlet~;
#X obj 26 113 fexpr~ $f2*$x1 + $f3*$x1[-1] + $f4*$x1[-2];
#X obj 122 80 r a0;
#X obj 218 82 r a1;
#X obj 315 83 r a2;
#X connect 0 0 2 0;
#X connect 2 0 1 0;
#X connect 3 0 2 1;
#X connect 4 0 2 2;
#X connect 5 0 2 3;
#X restore 172 208 pd unknown_system~;
#X obj 44 433 tgl 20 0 audio_io empty empty 0 -6 0 8 -262144 -1 -1
0 1;
#X text 69 435 <- Audio IO;
#N canvas 253 248 419 287 adaptive_filter~ 0;
#X obj 37 35 inlet~;
#X text 22 15 input signal;
#X obj 143 35 inlet~;
#X text 122 15 desired signal;
#X obj 37 255 outlet~;
#X msg 249 63 adaptation 1;
#X obj 249 42 loadbang;
#X obj 249 141 r clear;
#X msg 248 162 clear;
#X obj 37 149 lms2~ 3 0.01;
#X obj 116 227 unpack f f f;
#X obj 162 255 outlet;
#X obj 208 255 outlet;
#X obj 249 94 r mu;
#X msg 249 116 mu \$1;
#X obj 116 255 outlet;
#N canvas 0 0 450 300 calc_misalignment 0;
#X obj 19 20 inlet;
#X obj 19 70 unpack f f f;
#X obj 175 105 r a0;
#X obj 227 105 r a1;
#X obj 280 105 r a2;
#X obj 19 126 expr (($f1-$f4)+($f2-$f5)+($f3-$f6))/3;
#X obj 19 156 sig~;
#X obj 19 184 s~ misalignment;
#X connect 0 0 1 0;
#X connect 1 0 5 0;
#X connect 1 1 5 1;
#X connect 1 2 5 2;
#X connect 2 0 5 3;
#X connect 3 0 5 4;
#X connect 4 0 5 5;
#X connect 5 0 6 0;
#X connect 6 0 7 0;
#X restore 269 254 pd calc_misalignment;
#X obj 75 180 s~ lms_error;
#X connect 0 0 9 0;
#X connect 2 0 9 1;
#X connect 5 0 9 0;
#X connect 6 0 5 0;
#X connect 7 0 8 0;
#X connect 8 0 9 0;
#X connect 9 0 4 0;
#X connect 9 1 17 0;
#X connect 9 2 10 0;
#X connect 9 2 16 0;
#X connect 10 0 15 0;
#X connect 10 1 11 0;
#X connect 10 2 12 0;
#X connect 13 0 14 0;
#X connect 14 0 9 0;
#X restore 43 308 pd adaptive_filter~;
#X text 51 212 x[n];
#X text 183 230 d[n];
#X text 33 327 y[n];
#X obj 84 550 bng 20 250 50 0 clear empty empty 0 -6 0 8 -262144 -1
-1;
#X text 113 552 <- clear coefficients \, so adaptation will start again
;
#X text 42 470 unknown system:;
#X text 72 494 d[n] =;
#X floatatom 85 349 6 0 0 1 c0 - -;
#X floatatom 149 349 6 0 0 1 c1 - -;
#X floatatom 211 349 6 0 0 1 c2 - -;
#X text 40 529 adaptive filter:;
#X floatatom 408 167 8 0 0 0 mu: mur mu;
#N canvas 215 124 811 210 init 0;
#X obj 321 45 loadbang;
#X msg 138 98 0.33;
#X msg 179 99 0.33;
#X msg 223 100 0.33;
#X obj 138 121 s a0r;
#X obj 178 122 s a1r;
#X obj 223 123 s a2r;
#X obj 330 124 s mur;
#X msg 329 100 0.01;
#X msg 625 114 \; pd dsp \$1;
#X obj 625 89 r audio_io;
#X obj 395 127 s noiser;
#X msg 394 104 40;
#X obj 463 130 s amp_in_r;
#X msg 463 108 100;
#X connect 0 0 1 0;
#X connect 0 0 2 0;
#X connect 0 0 3 0;
#X connect 0 0 8 0;
#X connect 0 0 12 0;
#X connect 0 0 14 0;
#X connect 1 0 4 0;
#X connect 2 0 5 0;
#X connect 3 0 6 0;
#X connect 8 0 7 0;
#X connect 10 0 9 0;
#X connect 12 0 11 0;
#X connect 14 0 13 0;
#X restore 862 557 pd init;
#X floatatom 125 495 4 0 1 0 - a0r a0;
#X text 158 495 x[n] +;
#X text 243 496 x[n-1] +;
#X floatatom 210 496 4 0 1 0 - a1r a1;
#X floatatom 311 497 4 0 1 0 - a2r a2;
#X text 344 496 x[n-2];
#N canvas 327 0 479 730 PROBLEM_DESCRIPTION 0;
#X text 29 126 The unknown system is a FIR filter of order 3 and the
adaptive system is an adaptive transversal filter using the LMS algorithm
(see lms~ help-patch) with 3 coefficients.;
#X text 75 224 d[n] = h0*x[n] + h1*x[n-1] + h2*x[n-2];
#X text 35 188 unknown system:;
#X text 74 209 FIR Filter \, order = 3;
#X text 35 259 adaptive system:;
#X text 77 278 LMS \, 3 coefficients (c0 \, c1 \, c2);
#X text 77 292 step-size parameter mu;
#X text 188 40 MISADJUSTMENT;
#X text 28 84 This patch calculates the misadjustment in a noisy system
identification problem.;
#X text 33 325 The input signal and the additional noise are uniformly
distributed random numbers with zero mean and different variances.
;
#X text 29 399 Mean Square Error: MSE[n] = E[abs(e[n])^2];
#X text 29 416 MSE_min: Minimum Error = variance^2 of the additional
noise;
#X text 29 497 limes n to infinity MSE[n] = MSE_excess + MSE_min;
#X text 26 538 The ratio of the Excess Error and the Minimum Error
is defined as the Misadjustment:;
#X text 109 573 MISADJ = MSE_excess / MSE_min;
#X text 28 619 LMS Adaptive Filter Design Trade Off:;
#X text 142 644 tao * MISADJ = N/2;
#X text 108 673 N ... Nr of coefficients;
#X text 107 687 tao ... convergence time constant;
#X text 39 448 v[n] = c[n]-h[n] \, so the difference between the adaptive
and the unknown system;
#X text 29 433 MSE_excess: Excess Error = E[v[n]^2*x[n]^2] (Misalignment)
;
#X restore 34 94 pd PROBLEM_DESCRIPTION;
#X text 33 73 ReadMe:;
#N canvas 0 0 320 300 input_signal~ 0;
#X obj 89 69 noise~;
#X obj 89 196 *~;
#X obj 89 255 outlet~;
#X text 65 43 white signal:;
#X obj 105 151 r amp_in;
#X obj 105 174 dbtorms;
#X obj 219 212 env~;
#X obj 219 232 dbtorms;
#X obj 219 254 s in_power;
#X obj 107 222 s~ in_sig;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 1 0 6 0;
#X connect 1 0 9 0;
#X connect 4 0 5 0;
#X connect 5 0 1 1;
#X connect 6 0 7 0;
#X connect 7 0 8 0;
#X restore 43 181 pd input_signal~;
#X obj 172 271 +~;
#N canvas 0 0 450 300 add_noise~ 0;
#X obj 142 69 noise~;
#X obj 142 173 *~;
#X obj 158 111 r noise;
#X obj 142 251 outlet~;
#X obj 158 143 dbtorms;
#X obj 266 191 s~ add-noise;
#X connect 0 0 1 0;
#X connect 1 0 3 0;
#X connect 1 0 5 0;
#X connect 2 0 4 0;
#X connect 4 0 1 1;
#X restore 224 255 pd add_noise~;
#X floatatom 771 163 5 0 0 1 dB noiser noise;
#X floatatom 583 166 5 0 0 1 dB amp_in_r amp_in;
#X text 33 30 MISADJUSTMENT - NOISY SYSTEM IDENTIFICATION;
#X text 408 65 different cases:;
#N canvas 40 12 322 729 case-study 0;
#X obj 24 21 inlet;
#X obj 24 50 sel 0 1 2 3 4 5 6 7;
#X obj 79 127 s mur;
#X obj 121 128 s noiser;
#X obj 182 128 s amp_in_r;
#X obj 24 126 s start;
#X msg 24 103 bang;
#X obj 24 78 t b b;
#X msg 182 105 100;
#X msg 79 104 0.01;
#X obj 78 202 s mur;
#X obj 120 203 s noiser;
#X obj 181 203 s amp_in_r;
#X obj 23 201 s start;
#X msg 23 178 bang;
#X obj 23 153 t b b;
#X obj 77 279 s mur;
#X obj 119 280 s noiser;
#X obj 180 280 s amp_in_r;
#X obj 22 278 s start;
#X msg 22 255 bang;
#X obj 22 230 t b b;
#X obj 77 355 s mur;
#X obj 119 356 s noiser;
#X obj 180 356 s amp_in_r;
#X obj 22 354 s start;
#X msg 22 331 bang;
#X obj 22 306 t b b;
#X obj 78 430 s mur;
#X obj 120 431 s noiser;
#X obj 181 431 s amp_in_r;
#X obj 23 429 s start;
#X msg 23 406 bang;
#X obj 23 381 t b b;
#X obj 78 506 s mur;
#X obj 120 507 s noiser;
#X obj 181 507 s amp_in_r;
#X obj 23 505 s start;
#X msg 23 482 bang;
#X obj 23 457 t b b;
#X msg 78 483 0.01;
#X obj 78 581 s mur;
#X obj 120 582 s noiser;
#X obj 181 582 s amp_in_r;
#X obj 23 580 s start;
#X msg 23 557 bang;
#X obj 23 532 t b b;
#X obj 78 660 s mur;
#X obj 120 661 s noiser;
#X obj 181 661 s amp_in_r;
#X obj 23 659 s start;
#X msg 23 636 bang;
#X obj 23 611 t b b;
#X msg 120 105 30;
#X msg 119 180 50;
#X msg 181 180 70;
#X msg 78 179 0.001;
#X msg 77 256 0.001;
#X msg 180 257 97;
#X msg 118 257 50;
#X msg 118 333 80;
#X msg 180 333 40;
#X msg 77 332 2;
#X msg 78 407 0.005;
#X msg 119 408 4;
#X msg 181 408 10;
#X msg 181 484 90;
#X msg 120 484 60;
#X msg 181 559 98;
#X msg 119 559 80;
#X msg 78 558 0.008;
#X msg 119 638 40;
#X msg 181 638 80;
#X msg 78 637 0.9;
#X connect 0 0 1 0;
#X connect 1 0 7 0;
#X connect 1 1 15 0;
#X connect 1 2 21 0;
#X connect 1 3 27 0;
#X connect 1 4 33 0;
#X connect 1 5 39 0;
#X connect 1 6 46 0;
#X connect 1 7 52 0;
#X connect 6 0 5 0;
#X connect 7 0 6 0;
#X connect 7 1 9 0;
#X connect 7 1 53 0;
#X connect 7 1 8 0;
#X connect 8 0 4 0;
#X connect 9 0 2 0;
#X connect 14 0 13 0;
#X connect 15 0 14 0;
#X connect 15 1 56 0;
#X connect 15 1 54 0;
#X connect 15 1 55 0;
#X connect 20 0 19 0;
#X connect 21 0 20 0;
#X connect 21 1 57 0;
#X connect 21 1 59 0;
#X connect 21 1 58 0;
#X connect 26 0 25 0;
#X connect 27 0 26 0;
#X connect 27 1 62 0;
#X connect 27 1 60 0;
#X connect 27 1 61 0;
#X connect 32 0 31 0;
#X connect 33 0 32 0;
#X connect 33 1 63 0;
#X connect 33 1 64 0;
#X connect 33 1 65 0;
#X connect 38 0 37 0;
#X connect 39 0 38 0;
#X connect 39 1 40 0;
#X connect 39 1 67 0;
#X connect 39 1 66 0;
#X connect 40 0 34 0;
#X connect 45 0 44 0;
#X connect 46 0 45 0;
#X connect 46 1 70 0;
#X connect 46 1 69 0;
#X connect 46 1 68 0;
#X connect 51 0 50 0;
#X connect 52 0 51 0;
#X connect 52 1 73 0;
#X connect 52 1 71 0;
#X connect 52 1 72 0;
#X connect 53 0 3 0;
#X connect 54 0 11 0;
#X connect 55 0 12 0;
#X connect 56 0 10 0;
#X connect 57 0 16 0;
#X connect 58 0 18 0;
#X connect 59 0 17 0;
#X connect 60 0 23 0;
#X connect 61 0 24 0;
#X connect 62 0 22 0;
#X connect 63 0 28 0;
#X connect 64 0 29 0;
#X connect 65 0 30 0;
#X connect 66 0 36 0;
#X connect 67 0 35 0;
#X connect 68 0 43 0;
#X connect 69 0 42 0;
#X connect 70 0 41 0;
#X connect 71 0 48 0;
#X connect 72 0 49 0;
#X connect 73 0 47 0;
#X restore 410 112 pd case-study;
#N canvas 0 0 450 300 graph3 0;
#X array MSE 20000 float 0;
#X coords 0 100 19999 0 400 140 1;
#X restore 408 318 graph;
#N canvas 176 526 1013 385 visualisation 0;
#X obj 29 34 r start;
#X obj 29 60 t b b;
#X obj 59 85 s clear;
#X obj 29 241 tabwrite~ MSE;
#X text 283 29 Excess Error:;
#X obj 705 95 t b f;
#X text 454 32 Misadjustment:;
#X obj 457 122 /;
#X msg 429 337 \; MSE yticks 0 5 5;
#X text 662 34 MSE:;
#X obj 285 204 dbtorms;
#X msg 552 337 \; MSE ylabel 20600 0 25 50 75 100;
#X obj 300 169 s excess_db;
#X obj 305 233 s excess;
#X obj 644 127 +;
#X obj 809 73 r~ add-noise;
#X obj 809 117 dbtorms;
#X obj 809 141 s noise_power;
#X obj 72 138 r~ add-noise;
#X obj 429 268 loadbang;
#X obj 644 75 r excess;
#X obj 705 75 r noise_power;
#X obj 659 155 s mse;
#X obj 658 205 s mse_db;
#X obj 644 180 rmstodb;
#X obj 457 73 r excess;
#X obj 518 94 t b f;
#X obj 518 74 r noise_power;
#X obj 457 153 s misadj;
#X obj 285 145 env~ 64;
#X obj 809 95 env~ 64;
#X obj 56 195 env~ 64;
#X msg 429 302 \; MSE xticks 0 500 5;
#X msg 563 302 \; MSE xlabel -10 0 5000 10000 15000 20000;
#X floatatom 356 205 5 0 0 0 - - -;
#X obj 284 76 r~ misalignment;
#X obj 56 172 +~;
#X obj 302 102 r~ in_sig;
#X obj 285 123 *~;
#X connect 0 0 1 0;
#X connect 1 0 3 0;
#X connect 1 1 2 0;
#X connect 5 0 14 0;
#X connect 5 1 14 1;
#X connect 7 0 28 0;
#X connect 10 0 13 0;
#X connect 14 0 22 0;
#X connect 14 0 24 0;
#X connect 15 0 30 0;
#X connect 16 0 17 0;
#X connect 18 0 36 1;
#X connect 19 0 8 0;
#X connect 19 0 11 0;
#X connect 19 0 32 0;
#X connect 19 0 33 0;
#X connect 20 0 14 0;
#X connect 21 0 5 0;
#X connect 24 0 23 0;
#X connect 25 0 7 0;
#X connect 26 0 7 0;
#X connect 26 1 7 1;
#X connect 27 0 26 0;
#X connect 29 0 10 0;
#X connect 29 0 12 0;
#X connect 29 0 34 0;
#X connect 30 0 16 0;
#X connect 31 0 3 0;
#X connect 35 0 38 0;
#X connect 36 0 31 0;
#X connect 37 0 38 1;
#X connect 38 0 29 0;
#X connect 38 0 36 0;
#X restore 742 557 pd visualisation;
#X text 387 183 (step-size);
#X text 504 166 in-signal:;
#X floatatom 583 183 6 0 0 1 rms in_power -;
#X floatatom 771 180 6 0 0 1 rms noise_power -;
#X text 695 163 add-noise:;
#X obj 410 84 hradio 25 1 0 8 empty empty empty 0 -6 0 8 -262144 -1
-1 0;
#X text 408 229 Excess Error:;
#X floatatom 509 229 5 0 0 1 dB excess_db -;
#X floatatom 586 229 7 0 0 1 rms excess -;
#X text 567 228 ->;
#X text 402 253 Misadjustment:;
#X floatatom 509 253 7 0 0 1 - misadj -;
#X text 469 279 MSE:;
#X floatatom 509 278 5 0 0 1 dB mse_db -;
#X floatatom 586 278 7 0 0 1 rms mse -;
#X text 567 277 ->;
#X text 790 292 MSE [dB];
#X obj 712 250 bng 20 250 50 0 start empty empty 0 -6 0 8 -262144 -1
-1;
#X text 830 463 [samples];
#X text 741 252 <- draw MSE;
#N canvas 876 202 465 319 OBSERVATIONS 0;
#X text 22 22 OBSERVATIONS;
#X text 24 61 different cases:;
#X text 24 137 3) slow learning \, but adaptation works;
#X text 24 96 1) little bit add-noise \, adaptation works well;
#X text 24 116 2) too much add-noise;
#X text 24 192 5) very low in-signal and add-noise \, adaptation does
not work;
#X text 24 225 6) adaptation works;
#X text 24 244 7) very high add-noise level \, but adaptation works
;
#X text 24 263 8) adaptation works \, high step-size (so in some cases
this will be unstable);
#X text 23 158 4) more add-noise than in-signal and very high step-size
-> so sometimes this is unstable !;
#X restore 34 120 pd OBSERVATIONS;
#X text 418 90 1;
#X text 442 90 2;
#X text 467 90 3;
#X text 492 90 4;
#X text 517 90 5;
#X text 542 90 6;
#X text 567 90 7;
#X text 592 90 8;
#X text 537 183 power:;
#X text 727 179 power:;
#X connect 0 0 26 0;
#X connect 3 1 11 0;
#X connect 3 2 12 0;
#X connect 3 3 13 0;
#X connect 25 0 0 0;
#X connect 25 0 3 0;
#X connect 26 0 3 1;
#X connect 27 0 26 1;
#X connect 40 0 32 0;
