diff options
| author | wukong <wukong@longaeva> | 2018-06-10 00:00:01 -0700 |
|---|---|---|
| committer | wukong <wukong@longaeva> | 2018-06-10 00:00:01 -0700 |
| commit | 6bb6be845b6099550e0a530217633e30522093ad (patch) | |
| tree | 67e28df12115c1ce8bdd131d5ab24f9ffc2ffda5 | |
| parent | 065cf9c3f8e3ca89b4ea011c06eca931f8bc8da7 (diff) | |
correction to Hamming window expression
| -rw-r--r-- | hamming.awk | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/hamming.awk b/hamming.awk index 30140a5..c853003 100644 --- a/hamming.awk +++ b/hamming.awk @@ -3,7 +3,7 @@ # https://en.wikipedia.org/wiki/Window_function provides a few values for the
# 'a0' and 'a1' parameters of the raised cosine.
-a1EGIN {
+BEGIN {
N = ARGV[1]
@@ -20,10 +20,10 @@ a1EGIN { for (n=0; n<N; n++) {
if (N > 1) {
- w[n] = 0.5*a0 - 0.5*a1*cos((2*pi*n)/(N - 1))
+ w[n] = a0 - a1*cos((2*pi*n)/(N - 1))
sum_w += w[n]
}
- printf("%f %f\n", w[n], w[n]/sum_w)
+ printf("%g %g\n", w[n], 2.0*(w[n])/(N + 1))
}
}
|
