diff options
| author | wukong <wukong@longaeva> | 2026-04-10 23:46:12 -0700 |
|---|---|---|
| committer | wukong <wukong@longaeva> | 2026-04-10 23:46:12 -0700 |
| commit | 4c4eb1bd8f003b3b57707badd2dd089ed193a896 (patch) | |
| tree | 15b62907fffd70c46a9b4369df93ab33c6aa88ac /quad_reg.awk | |
| parent | e7d1781578e846a7b1d634cd43c8fab00a67b883 (diff) | |
renamed fir window generators;
minor edits to whitespace and comments for more consistent style;
Diffstat (limited to '')
| -rw-r--r-- | quad_reg.awk | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/quad_reg.awk b/quad_reg.awk index edd0c6f..2682a0f 100644 --- a/quad_reg.awk +++ b/quad_reg.awk @@ -3,6 +3,7 @@ ### quad_reg.awk # quadratic regression along columns + BEGIN { OFS = ":" pi = 4.0*atan2(1.0, 1.0) @@ -13,22 +14,26 @@ BEGIN { number = "^" sign "(" decimal "|" fraction ")" exponent "$" } + +# column headers NR == 1 { for (n=1; n<=NF; n++) ($n ~ number) ? header[n] = "col" n : header[n] = $n } + +# read input data NF > 0 { - if (NF > nf_max) - nf_max = NF + (NF > nf_max) ? nf_max = NF : nf_max = nf_max - ### iterate over columns + # columns for (y=1; y<=nf_max; y++) { if ($y == header[n]) continue + if ($y ~ number) { - ### mean + # mean count[y] += 1 sum[y] += $y sum2[y] += $y*$y @@ -42,7 +47,7 @@ NF > 0 { sum_delta[y] += delta1[y] sum_delta2[y] += delta2[y] - ### sample variance + # sample variance #(count[y] > 1) ? var[y] = sum_delta2[y]/(count[y] - 1) : var[y] = "" # x = row, y = col, trendline: y = A + Bx + Cx^2 @@ -115,6 +120,7 @@ NF > 0 { } } + END { for (x=1; x<=nf_max; x++) { for (y=1; y<=nf_max; y++) { |
