-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathlinpred_5
477 lines (462 loc) · 12 KB
/
linpred_5
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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
; Test for forward linear prediction calculated by LPSVD
; T.Malliavin first version
; G.Salnikov jan-1996 : added peak sorting
dim 1
order 10
simu 6024 512 2 1.0 3123 1.0 0. \
1.0 5001 1.0 0. 0.0
dt->svd 512
svd->ar 1
ar->dt 1k 1
itype 0 evaln 1 1k itype 1
set a = (abs($noise - .95968282)<0.001)
set b = (abs($shift - .226734569878E-03)<0.001)
report ($a & $b) "Forward Linear Prediction by LPSVD"
; forward linear prediction coeff calculated by LPSVD
;Number of AR coefficients : 10
;Forward coeff. of PE polynome
; .032423
; .218044
; -.135395
; -.069564
; -.022323
; .031589
; .083497
; -.560398
; .330764
; .119651
; -.255565
; -.082291
; .069599
; .047879
; .009635
; .261716
; .309227
; -.071307
; -.189211
; .000804
; Test for backward linear prediction by LPSVD
dim 1
order 10
simu 6024 512 2 1.0 3123 1.0 0. \
1.0 5001 1.0 0. 0.0
dt->svd 512
svd->ar 2
ar->dt 1k 2
itype 0 evaln 1 1k itype 1
set a = (abs($noise - 1.00010108948)<0.001)
set b = (abs($shift - .145896791946E-02)<0.001)
report ($a & $b) "Backward Linear Prediction by LPSVD"
; backward linear prediction coeff calculated by LPSVD
;Number of AR coefficients : 10
;Backward coeff. of PE polynome
; .211119
; -.018458
; -.129454
; .013135
; .123079
; -.092347
; .236444
; .761579
; .149035
; .181000
; -.181964
; .033043
; .164967
; .020283
; -.073370
; -.050815
; .152297
; .031029
; -.123679
; -.005283
; Test for forward linear prediction and spectrum calculation by the Burg method
dim 1
order 10
simu 6024 512 1 1.0 3123 1.0 0. 0.0
dt->ar
ar->dt 1k 1
itype 0 evaln 1 1k itype 1
set a = (abs($noise - .684671044350)<0.001)
set b = (abs($shift - .664793420583E-03)<0.001)
ar->sp
max
set c = (abs($max[1] - .312438824039E-04)<0.001)
set d = (abs($max[2] - .178954522312E-07)<0.001)
report ($a & $b & $c & $d) "Forward Linear Prediction and spectrum calculation by the Burg method"
; Linear prediction coefficients calculated by the Burg method
;Number of AR coefficients : 10
;Forward coeff. of PE polynome
; 1.298755
; .151038
; .205728
; .048508
; -.028264
; -.010233
; .012509
; .006233
; -.006552
; -.004286
; .003542
; .002954
; -.001666
; -.001754
; .000144
; .000191
; .004596
; .007862
; .018509
; .042231
; Test for spectral analysis by forward LPSVD
dim 1
order 10
simu 6024 512 2 1.0 3123 1.0 0. \
1.0 5001 1.0 0. 0.0
dt->svd 512
svd->ar 1
ar->rt 1
rt->pk 512 1 0.0
unit h
pkclean below 0.001
for i = 1 to $npk1d
set f[$i] := $pk1d_f[$i]
set w[$i] := $pk1d_w[$i]
endfor
for i = 1 to ($npk1d-1)
if ($f[$i] > $f[$i+1]) then
for j = $i to 1 step -1
if ($f[$j] > $f[$j+1]) then
set k = $f[$j+1]
set f[$j+1] = $f[$j]
set f[$j] = $k
set k = $w[$j+1]
set w[$j+1] = $w[$j]
set w[$j] = $k
endif
endfor
endif
endfor
set a = (abs($f[1] - 86.9482116699) < 0.001)
set b = (abs($f[2] - 246.565734863) < 0.001)
set c = (abs($w[1] - .270543918014E-01) < 0.001)
set d = (abs($w[2] - .270575433969E-01) < 0.001)
report ($a & $b & $c & $d) "Spectral analysis by Forward LPSVD"
;Peaks computed with linear prediction
;Number of 1D peaks : 10
;Peak coordinates in HZ widthes in Hz
; Index Coord Ampli Volume Width Phase Type
; 1 4273.871 .112823E-06 .904885E-06 94.365 58.986 unknown
; 2 1955.547 .479791E-07 .853707E-06 209.350 152.705 unknown
; 3 447.116 .327822E-07 .242444E-06 87.014 98.625 unknown
; 4 2115.433 .491742E-07 .184734E-05 442.003 -58.959 unknown
; 5 1101.549 .631592E-08 .297399E-06 554.010 6.059 unknown
; 6 5697.313 .139044E-06 .734033E-05 621.123 124.380 unknown
; 7 5010.787 36.9626 1.00000 .318 .000 unknown
; 8 3129.112 36.9584 1.00000 .318 .000 unknown
; 9 3575.401 .111505E-06 .785088E-06 82.840 41.604 unknown
; 10 5886.629 .101792E-06 .952602E-05 1101.066 -90.490 unknown
pkselect 1 2 0
for i = 1 to $npk1d
set f[$i] := $pk1d_f[$i]
set w[$i] := $pk1d_w[$i]
endfor
for i = 1 to ($npk1d-1)
if ($f[$i] > $f[$i+1]) then
for j = $i to 1 step -1
if ($f[$j] > $f[$j+1]) then
set k = $f[$j+1]
set f[$j+1] = $f[$j]
set f[$j] = $k
set k = $w[$j+1]
set w[$j+1] = $w[$j]
set w[$j] = $k
endif
endfor
endif
endfor
set a = (abs($f[1] - 86.9482116699) < 0.5)
set b = (abs($w[2] - 0.270575117320E-01) < 0.5)
report ($a & $b) "PKSELECT"
;Peaks computed with linear prediction
;Number of 1D peaks : 2
; Peak coordinates in HZ widthes in Hz
; Index Coord Ampli Volume Width Phase Type
; 1 1955.547 .479791E-07 .853707E-06 209.350 152.705 Gauss
; 2 2115.433 .491742E-07 .184734E-05 442.003 -58.959 Gauss
; Test for spectral analysis by backward LPSVD
dim 1
order 10
simu 6024 512 2 1.0 3123 1.0 0. \
1.0 5001 1.0 0. 0.0
dt->svd 512
svd->ar 2
ar->rt 2
rtclean 2
rtinv 2
rt->pk 512 1 0.0
unit h
for i = 1 to $npk1d
set f[$i] := $pk1d_f[$i]
set w[$i] := $pk1d_w[$i]
endfor
for i = 1 to ($npk1d-1)
if ($f[$i] > $f[$i+1]) then
for j = $i to 1 step -1
if ($f[$j] > $f[$j+1]) then
set k = $f[$j+1]
set f[$j+1] = $f[$j]
set f[$j] = $k
set k = $w[$j+1]
set w[$j+1] = $w[$j]
set w[$j] = $k
endif
endfor
endif
endfor
set a = (abs($f[2] - 246.565734863) < 0.001)
set b = (abs($f[1] - 86.9482116699) < 0.001)
set c = (abs($w[2] - .270543918014E-01) < 0.001)
set d = (abs($w[1] - .270575433969E-01) < 0.001)
set e = ($nrt == 2)
report ($a & $b & $c & $d &$e) "Spectral analysis by Backward LPSVD"
;Number of 1D peaks : 2
;Peak coordinates in HZ widthes in Hz
; Index Coord Ampli Volume Width Phase Type
; 1 3129.112 36.9573 1.00000 .318 .000 unknown
; 2 5010.787 36.9623 1.00000 .318 .000 unknown
; Test for phase-minimum bacward and forward linear prediction by LPSVD
dim 1
order 10
simu 6024 512 2 1.0 3123 1.0 0. \
1.0 5001 1.0 0. 0.0
dt->svd 512
svd->ar 2
ar->rt 2
rtclean 2
rtinv 2
rt->ar 3
;Number of AR coefficients : 2
;Forward coeff. of PE polynome
; .510480
; .991116
; -.580482
; .813865
;Backward coeff. of PE polynome
; .510650
; -.991445
; -.580867
; -.814406
ar->dt 1k 1
itype 0 evaln 1 1k itype 1
set a = (abs($noise - .959682941437)<0.001)
set b = (abs($shift - .226510470384E-03)<0.001)
report ($a & $b) "Phase-minimum forward Linear Prediction by LPSVD"
chsize 512
ar->dt 1k 2
itype 0 evaln 1 1k itype 1
set a = (abs($noise - 1.00010097027)<0.001)
set b = (abs($shift - .145897129551E-02)<0.001)
report ($a & $b) "Phase-minimum backward Linear Prediction by LPSVD"
; Test for data recalculation from SVD decomposition
dim 1
order 10
simu 6024 512 2 1.0 3123 1.0 0. \
1.0 5001 1.0 0. 0.0
mult -1 put data mult -1
dt->svd 512
;number of SVD : 10
;Singular values
; 49.514317
; .000000
; 47.397547
; .000000
; .000176
; .000000
; .000167
; .000000
; .000137
; .000000
; .000080
; .000000
; .000064
; .000000
; .000056
; .000000
; .000054
; .000000
; .000046
; .000000
svdclean2 5.0 y
set c = ($nsvd == 2)
svdclean1 2 y
svd->dt
adddata
max
set a = (abs($max[1] - .160932540894E-04) < 0.001)
set b = (abs($max[2] + .217556953430E-04) < 0.001)
report ($a & $b &$c) "Data back-calculation from SVD decomposition"
; Test for forward linear prediction calculated by LPSVD using roots reflected into the unit-circle
dim 1
order 10
simu 6024 512 2 1.0 3123 1.0 0. \
1.0 5001 1.0 0. 0.0
dt->svd 512
svd->ar 1
ar->rt 1
rtreflect 1
rt->ar 1
ar->dt 1k 1
itype 0 evaln 1 1k itype 1
set a = (abs($noise - .95968062)<0.001)
set b = (abs($shift - .22652098E-03)<0.001)
report ($a & $b) "Forward Linear Prediction by LPSVD using reflected roots"
; forward linear prediction coeff calculated by LPSVD
;Number of AR coefficients : 10
;Forward coeff. of PE polynome
; .032423
; .218044
; -.135395
; -.069564
; -.022323
; .031589
; .083497
; -.560398
; .330764
; .119651
; -.255565
; -.082291
; .069599
; .047879
; .009635
; .261716
; .309227
; -.071307
; -.189211
; .000804
; Test for spectral analysis by backward LPSVD
dim 1
order 10
simu 6024 512 2 1.0 3123 1.0 0. \
1.0 5001 1.0 0. 0.0
dt->svd 512
svd->ar 3
ar->rt 3
rtmatch 2
rt->pk 512 2 0.0
unit h
for i = 1 to $npk1d
set f[$i] := $pk1d_f[$i]
set w[$i] := $pk1d_w[$i]
endfor
for i = 1 to ($npk1d-1)
if ($f[$i] > $f[$i+1]) then
for j = $i to 1 step -1
if ($f[$j] > $f[$j+1]) then
set k = $f[$j+1]
set f[$j+1] = $f[$j]
set f[$j] = $k
set k = $w[$j+1]
set w[$j+1] = $w[$j]
set w[$j] = $k
endif
endfor
endif
endfor
set a = (abs($f[2] - 246.565734863) < 0.001)
set b = (abs($f[1] - 86.9482116699) < 0.001)
set c = (abs($w[2] - .270579215139E-01) < 0.001)
set d = (abs($w[1] - .270544942468E-01) < 0.001)
set e = ($nrt == 2)
report ($a & $b & $c & $d &$e) "Spectral analysis by Matched LPSVD"
;Peaks computed with linear prediction
;Number of 1D peaks : 2
;Peak coordinates in HZ widthes in Hz
; Index Coord Ampli Volume Width Phase Type
; 1 3129.112 36.9579 1.00000 .318 .000 Gauss
; 2 5010.787 36.9624 1.00000 .318 .000 Gauss
; Test for spectral analysis by forward LPSVD
dim 1
order 10
simu 6024 512 2 1.0 3123 1.0 0. \
1.0 5001 1.0 0. 0.0
dt->svd 512
svd->ar 1
ar->rt 1
rtselect 1 1 2 3 4 5 6 7 8 9 10 0
set a = ($nrt == 10)
rt->pk 512 1 0.
pkclean below 0.001
for i = 1 to $npk1d
set f[$i] := $pk1d_f[$i]
set w[$i] := $pk1d_w[$i]
endfor
for i = 1 to ($npk1d-1)
if ($f[$i] > $f[$i+1]) then
for j = $i to 1 step -1
if ($f[$j] > $f[$j+1]) then
set k = $f[$j+1]
set f[$j+1] = $f[$j]
set f[$j] = $k
set k = $w[$j+1]
set w[$j+1] = $w[$j]
set w[$j] = $k
endif
endfor
endif
endfor
set b = (abs($f[1] - 86.9482116699) < 0.5)
set c = (abs($f[2] - 246.565734863) < 0.5)
set d = (abs($w[1] - 0.270543936640E-01) < 0.5)
set e = (abs($w[2] - 0.270575117320E-01) < 0.5)
report ($a & $b & $c & $d &$e) "RTSELECT"
;Number of Root 3
;forward roots of PE polynome
; -.247805
; -.919160
; .853978
; .428907
; .678869
; -.249615
;Peaks computed with linear prediction
;Number of 1D peaks : 3
;Peak coordinates in INDEX widthes in Hz
; Index Coord Ampli Volume Width Phase Type
; 1 149.459 .659790E-02 .529180E-01 94.365 65.051 unknown
; 2 474.072 .150557E-01 .111346 87.014 46.328 unknown
; 3 28.712 .191453E-01 1.01070 621.123 -41.029 unknown
; Test for forward linear prediction and spectrum calculation by the Burg method (BURG command)
dim 1
order 10
simu 6024 512 1 1.0 3123 1.0 0. 0.0
; if ($config_os s= "DARWIN") then
; print "SORRY, BURG is not implemented on Darwin yet"
; else
burg 1k
itype 0 evaln 1 1k itype 1
set a = (abs($noise - .684670567513)<0.001)
set b = (abs($shift - .664792780299E-03)<0.001)
report ($a & $b) "BURG command"
; endif
; Linear prediction coefficients calculated by the Burg method
;Number of AR coefficients : 10
;Forward coeff. of PE polynome
; 1.298755
; .151038
; .205728
; .048508
; -.028264
; -.010233
; .012509
; .006233
; -.006552
; -.004286
; .003542
; .002954
; -.001666
; -.001754
; .000144
; .000191
; .004596
; .007862
; .018509
; .042231