aboutsummaryrefslogtreecommitdiff
path: root/adaptive/examples/08.decision-directed_equalization.pd
blob: e81c5aaec4fd5ec0d66eb2d8bbd39bf0dfcb6c08 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
#N canvas 0 0 815 449 10;
#N canvas 713 200 313 209 delay~ 0;
#X obj 42 45 inlet~;
#X obj 43 139 outlet~;
#X obj 43 89 z~ 60;
#X connect 0 0 2 0;
#X connect 2 0 1 0;
#X restore 176 261 pd delay~;
#N canvas 684 469 305 289 channel~ 0;
#X obj 39 120 bp~ 500 10;
#X text 72 96 dummy filter + latency;
#X obj 39 36 inlet~;
#X obj 40 234 outlet~;
#X obj 40 182 z~ 60;
#X connect 0 0 4 0;
#X connect 2 0 0 0;
#X connect 4 0 3 0;
#X restore 29 262 pd channel~;
#N canvas 490 469 479 338 PROBLEM_DESCRIPTION 0;
#X text 57 137 possible symbols: -1 \, 1;
#X text 55 160 the decision device is implemented by d=sign(y);
#X text 72 40 DECISION-DIRECTED CHANNEL EQUALIZATION;
#X text 27 189 The adaptive equalizer tries to invert the channel \,
so that the overal system has a flat frequency response and there are
almost no bit errors.;
#X text 28 280 We simulate the transmission with a simple bandpass
filter and a delay (= the channel).;
#X text 28 241 Bit errors are plotted over time for equalized and unequalized
transmission.;
#X text 27 83 This patch simulates the equalization of a baseband transmission
of a binary signal (similar to the adaptation process in e.g. a modem).
;
#X restore 28 106 pd PROBLEM_DESCRIPTION;
#N canvas 493 226 453 208 OBSERVATIONS 0;
#X text 21 30 OBSERVATIONS;
#X text 19 77 You can see that if you train the system long enough
there are almost no bit errors.;
#X text 20 126 A critical parameter is the delay: If you don't find
the exact delay of the channel adaptation works very bad for uncorrelated
training sequences.;
#X restore 28 130 pd OBSERVATIONS;
#X text 27 85 ReadMe:;
#N canvas 752 62 617 174 init 0;
#X obj 256 43 loadbang;
#X obj 213 120 s mur;
#X msg 515 103 \; pd dsp \$1;
#X obj 515 78 r audio_io;
#X msg 212 96 0.1;
#X obj 125 118 s moder;
#X msg 125 97 0;
#X connect 0 0 4 0;
#X connect 0 0 6 0;
#X connect 3 0 2 0;
#X connect 4 0 1 0;
#X connect 6 0 5 0;
#X restore 679 389 pd init;
#X obj 708 108 tgl 20 0 audio_io empty empty 0 -6 0 8 -262144 -1 -1
0 1;
#X floatatom 684 139 6 0 0 0 - mur mu;
#X text 546 138 learning rate (mu):;
#N canvas 0 0 450 300 input_signal~ 0;
#X obj 59 74 noise~;
#X obj 60 120 expr~ if($v1>=0 \, 1 \, -1);
#X text 75 104 signum:;
#X obj 60 182 outlet~;
#X connect 0 0 1 0;
#X connect 1 0 3 0;
#X restore 29 198 pd input_signal~;
#N canvas 573 367 334 253 adaptive_equalizer~ 0;
#X obj 164 64 r mode;
#X obj 164 104 tgl 15 0 empty empty empty 0 -6 0 8 -262144 -1 -1 0
1;
#X msg 164 123 adaptation \$1;
#X obj 31 34 inlet~;
#X obj 108 34 inlet~;
#X obj 163 151 r mode;
#X obj 163 191 sel 1;
#X msg 163 212 init_unity;
#X obj 30 205 outlet~;
#N canvas 922 527 390 347 nlms~ 0;
#X obj 37 35 inlet~;
#X obj 155 44 inlet~;
#X text 134 24 desired signal;
#X obj 36 291 outlet~;
#X obj 261 135 loadbang;
#X msg 264 300 clear;
#X obj 262 250 r mu;
#X msg 262 272 mu \$1;
#X text 36 313 outsig1;
#X text 38 14 insig1;
#X msg 274 201 init_unity;
#X obj 261 156 t b b;
#X msg 59 96 print;
#X msg 261 178 adaptation 0;
#X obj 341 38 inlet;
#X obj 37 156 nlms~ 10 0.01;
#X connect 0 0 15 0;
#X connect 1 0 15 1;
#X connect 4 0 11 0;
#X connect 5 0 15 0;
#X connect 6 0 7 0;
#X connect 7 0 15 0;
#X connect 10 0 15 0;
#X connect 11 0 13 0;
#X connect 11 1 10 0;
#X connect 12 0 15 0;
#X connect 13 0 15 0;
#X connect 14 0 15 0;
#X connect 15 0 3 0;
#X restore 30 140 pd nlms~;
#X obj 164 84 expr if($f1==1 \, 1 \, 0);
#X obj 163 171 expr if($f1==0 \, 1 \, 0);
#X connect 0 0 10 0;
#X connect 1 0 2 0;
#X connect 2 0 9 2;
#X connect 3 0 9 0;
#X connect 4 0 9 1;
#X connect 5 0 11 0;
#X connect 6 0 7 0;
#X connect 7 0 9 2;
#X connect 9 0 8 0;
#X connect 10 0 1 0;
#X connect 11 0 6 0;
#X restore 28 337 pd adaptive_equalizer~;
#X obj 297 108 vradio 20 1 0 3 mode moder empty 0 -6 0 8 -262144 -1
-1 2;
#X text 292 90 mode:;
#X text 37 244 H_chan(z);
#X text 37 319 H_eq(z);
#X text 26 22 DECISION-DIRECTED CHANNEL EQUALIZATION;
#X text 323 111 unequalized transmission;
#N canvas 609 329 450 300 decision_device~ 0;
#X obj 25 38 inlet~;
#X obj 26 97 expr~ if($v1>=0 \, 1 \, -1);
#X text 41 81 signum:;
#X obj 270 38 inlet~;
#X obj 59 202 tabsend~ biterrors;
#X obj 59 173 expr~ if($v1==$v2 \, -1 \, 1);
#X connect 0 0 1 0;
#X connect 1 0 5 0;
#X connect 3 0 5 1;
#X connect 5 0 4 0;
#X restore 124 387 pd decision_device~;
#N canvas 0 0 450 300 graph3 0;
#X array biterrors 64 float 2;
#X coords 0 1.4 63 -1.4 350 140 1;
#X restore 380 245 graph;
#X text 734 257 error;
#X text 734 357 no error;
#X text 487 390 ---- 64 samples ----;
#X text 382 228 biterrors over time:;
#X text 624 110 Audio IO ->;
#X text 322 131 training;
#X text 323 150 equalized transmission;
#X text 302 112 1;
#X text 302 131 2;
#X text 302 151 3;
#N canvas 0 0 450 110 NEEDED_EXTERNALS 0;
#X text 16 38 For this patch you will need the zexy external by IOhannes
Zmoelnig: http://pd.iem.at;
#X restore 659 16 pd NEEDED_EXTERNALS;
#X connect 0 0 10 1;
#X connect 0 0 17 1;
#X connect 1 0 10 0;
#X connect 9 0 1 0;
#X connect 9 0 0 0;
#X connect 10 0 17 0;