Programmer Guide/Command Reference/EVAL/hth: Difference between revisions

From STX Wiki
Jump to navigationJump to search
m (1 revision: Initial import)
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
Compute spectral weights.
;Usage: <code>hth(<var>f</var>, <var>type</var>)</code>
:;<var>f</var>:A scalar, vector or matrix containing the frequency value(s) in Hz.
;<var>type</var>:The type of the spectral weight to be computed.
:;Result: The result ''w'' has the same type as the argument ''f'' and contains the values of the spectral weighting function selected by ''type'' (''w''[i,j] = '''weight'''(''f''[i,j],''type'')).
::{|
! ''type'' !! description !! [[1]]
|-
| 0 || hearing threshold in dB || || <pre>w[i] = 1</pre>
|-
| 1 || '''hanning'''  || not used || <code>whanning(''x''{,''scale''})</code>
| <pre>w[i] = 0.5 - 0.5 * cos( a*i )
with: a = 2 * pi / (n-1)</pre>
|-
| 2 || '''hamming'''  || not used || <code>whamming(''x''{,''scale''})</code>
| <pre>w[i] = 0.54 - 0.46 * cos( a*i )
with: a = 2 * pi / (n-1)</pre>
|-
| 3 || '''blackman'''  || 0<''par''<=0.25<BR>default=0.16 || <code>wblackman(''x''{,''scale''{,''par''}})</code>
| <pre>w[i] = (1-par)/2 - 0.5 * cos( a*i ) + par/2 * cos( 2*a*i )
with: a = 2 * pi / (n-1)</pre>
|-
| 4 || '''kaiser'''  || 0<''par''<BR>default=8 || <code>wkaiser(''x''{,''scale''{,''par''}})</code>
| <pre>w[i] = I0( par / m * sqrt(m^2 - (i-m)^2) ) / I0( par )
with: m = (n-1) / 2
      I0(z) is the modfied zero-order bessel function</pre>
|-
| 5 || '''bartlett'''<BR>(triangle)  || not used || <code>wbartlett(''x''{,''scale''})</code>
| <pre>0 <= i <= m:  w[i] = i / m
m <  i <  n: w[i] = 2 - i / m
with: m = (n-1) / 2</pre>
|-
| 6 || '''tappered rectangle'''  || not used || <code>wtaprect(''x''{,''scale''})</code>
| A rectangle with to short hanning slopes.
|-
| 7 || '''nuttall'''  || not used || <code>wnuttall(''x''{,''scale''})</code>
| A 4-term blackman-harris window with high dynamic range, low frequency resolution and minimized maximum sidelobes.<BR>Nuttall, Albert H. "Some Windows with Very Good Sidelobe Behavior." IEEE Transactions on Acoustics, Speech, and Signal Processing. Vol. ASSP-29 (February 1981). pp. 84-91
|-
| 8 || '''flat-top'''  || not used || <code>wflattop(''x''{,''scale''})</code>
|  A 5-term blackman-harris window with high dynamic range, low frequency resolution and minimized passband ripple (< 0.01dB). Flat-top windows are primarily used for calibration purposes.
|-
| 9 || '''gauss'''  || 0<''par''<= 20<BR>default=3 || <code>wgauss(''x''{,''scale''{,''par''}})</code>
| <pre>w[i] = exp( -0.5 * (par * (m - i) / m) ^ 2 )
with: m = (n-1) / 2</pre>
|-
|}
::Notes:
::*If the argument ''type'' has an invalid value, the rectangle window is used.
::*If the energy-correction is enabled (argument ''scale''!=0), the values w[i] scaled by a factor that approximately equalises the energy loss caused by the window function. The scaling factor is computed using white noise as test signal.
::*If the argument ''par'' is supplied to a function not using this argument, it is ignored.
;Result: The result ''r'' depends on the argument ''x'':
:*x is a number: The value is used as window length ''n''. The result ''r'' is vector with length ''n'' containing the window function.
:*x is a vector or matrix: The number of rows of ''x'' is used as window length. Each column of ''x'' is multiplied with the window function (element-wise) and stored in a column of ''r''. The result ''r'' has the same type as ''x''.
;See also: [[Programmer_Guide/Command_Reference/EVAL/fft|fft]], [[Programmer_Guide/Command_Reference/EVAL/hth|hth]], [[Programmer_Guide/Command_Reference/EVAL/wconvert|wconvert]]
[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
=====hth=====
=====hth=====

Revision as of 11:35, 11 April 2011

Compute spectral weights.

Usage
hth(f, type)
f
A scalar, vector or matrix containing the frequency value(s) in Hz.
type
The type of the spectral weight to be computed.
Result
The result w has the same type as the argument f and contains the values of the spectral weighting function selected by type (w[i,j] = weight(f[i,j],type)).
type description 1
0 hearing threshold in dB
w[i] = 1
1 hanning not used whanning(x{,scale})
w[i] = 0.5 - 0.5 * cos( a*i )
with: a = 2 * pi / (n-1)
2 hamming not used whamming(x{,scale})
w[i] = 0.54 - 0.46 * cos( a*i )
with: a = 2 * pi / (n-1)
3 blackman 0<par<=0.25
default=0.16
wblackman(x{,scale{,par}})
w[i] = (1-par)/2 - 0.5 * cos( a*i ) + par/2 * cos( 2*a*i )
with: a = 2 * pi / (n-1)
4 kaiser 0<par
default=8
wkaiser(x{,scale{,par}})
w[i] = I0( par / m * sqrt(m^2 - (i-m)^2) ) / I0( par )
with: m = (n-1) / 2
      I0(z) is the modfied zero-order bessel function
5 bartlett
(triangle)
not used wbartlett(x{,scale})
0 <= i <= m:  w[i] = i / m
m <  i <  n: w[i] = 2 - i / m
with: m = (n-1) / 2
6 tappered rectangle not used wtaprect(x{,scale}) A rectangle with to short hanning slopes.
7 nuttall not used wnuttall(x{,scale}) A 4-term blackman-harris window with high dynamic range, low frequency resolution and minimized maximum sidelobes.
Nuttall, Albert H. "Some Windows with Very Good Sidelobe Behavior." IEEE Transactions on Acoustics, Speech, and Signal Processing. Vol. ASSP-29 (February 1981). pp. 84-91
8 flat-top not used wflattop(x{,scale}) A 5-term blackman-harris window with high dynamic range, low frequency resolution and minimized passband ripple (< 0.01dB). Flat-top windows are primarily used for calibration purposes.
9 gauss 0<par<= 20
default=3
wgauss(x{,scale{,par}})
w[i] = exp( -0.5 * (par * (m - i) / m) ^ 2 )
with: m = (n-1) / 2
Notes:
  • If the argument type has an invalid value, the rectangle window is used.
  • If the energy-correction is enabled (argument scale!=0), the values w[i] scaled by a factor that approximately equalises the energy loss caused by the window function. The scaling factor is computed using white noise as test signal.
  • If the argument par is supplied to a function not using this argument, it is ignored.
Result
The result r depends on the argument x:
  • x is a number: The value is used as window length n. The result r is vector with length n containing the window function.
  • x is a vector or matrix: The number of rows of x is used as window length. Each column of x is multiplied with the window function (element-wise) and stored in a column of r. The result r has the same type as x.


See also
fft, hth, wconvert

<function list>



hth

Hearing Threshold Level (HTH) or A/C spectral weightings.

Usage:

hth(f, type)

f
The frequency (scalar, vector or matrix).
type
The type of weighting function. The following values are supported:
0 - Hearing threshold level
1 - Hearing threshold weighting factor
2 - A weighting levels.
3 - A weighting factors.
4 - C weighting levels.
5 - C weighting factors.
Notes:

Factor = 1 / (10^(Level/20))

Result:

The result of the requested function (same datatype as f).

Navigation menu

Personal tools