Programmer Guide/SPU Reference/ZEROCROSS: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(8 intermediate revisions by the same user not shown)
Line 19: Line 19:


;Description:
;Description:
In this atom the zero crossings ''Z'' of the signal <var>X</var> are counted and than converted to the value selected by <var>TYPE</var>. If <var>XMIN</var>=0 all zero crossings, i.e. changes of signs, are counted. If <var>XMIN</var>&gt;0 the absolute signal magnitude has to exceed this value between two zero crossings.
To get more exact density, frequency and periode values, also the index (position) of the first (I<sub>1</sub>) and last (I<sub>N</sub>) zero crossing is computed.
{|class="einrahmen"
{|class="einrahmen"
!output !!<var>NORM</var>=<code>0</code> !!<var>NORM</var>=<code>1</code> !!description
!<var>TYPE</var> !!<var>Y</var> !!description
|-
|-
|<var>M1</var>
|<code>0</code> or <code>DENSITY</code>
|<math>\mu\!</math>
|<math>density=SR\cdot\frac{Z-1}{I_N-I_1+1}</math>
|<math>\mu\!</math>
|number of zero crossings per second
|mean: <math>\mu = \frac{\sum_{i=0}^{N-1} x_i px_i}{\sum_{i=0}^{N-1} px_i}</math>
|-
|-
|<var>M2</var>
|<code>1</code> or <code>FREQUENCY</code>
|<math>V\!</math>
|<math>frequency=\frac{density}{2}=\frac{SR}{2}\cdot\frac{Z-1}{I_N-I_1+1}</math>
|<math>\frac{V}{\mu}</math>
|frequeny in Hz
|variance: <math>\sigma^2 = V = \frac{\sum_{i=0}^{N-1}(x_i-\mu)^2px_i}{\sum_{i=0}^{N-1} px_i}</math>
|-
|-
|<var>M3</var>
|<code>2</code> or <code>PERIODE</code>
|<math>S\!</math>
|<math>periode=\frac{2}{density}=\frac{2}{SR}\cdot\frac{I_N-I_1+1}{Z-1}</math>
|<math>\frac{S}{\sqrt{V^3}}</math>
|periode duration in seconds
|skewness: <math>S = \frac{\sum_{i=0}^{N-1}(x_i-\mu)^3px_i}{\sum_{i=0}^{N-1} px_i}</math>
|-
|-
|<var>M4</var>
|<code>3</code> or <code>COUNT</code>
|<math>K\!</math>
|<math>count=Z\!</math>
|<math>\frac{K}{V^2}</math>
|number of zero crossings
|kurtosis: <math>K = \frac{\sum_{i=0}^{N-1}(x_i-\mu)^4px_i}{\sum_{i=0}^{N-1} px_i}</math>
|}
|}
Note: To compute density, frequency or periode, the value of ''Z'' (number of zero crossings) must be greater than 1. If ''Z''&lt;2 and <var>TYPE</var> equals <code>DENSITY</code>, <code>FREQUENCY</code> or <code>PERIODE</code>, <var>Y</var> is set to 0.
;See also:
;See also:
<[[../#Signal Processing Atoms|SP-atoms]]>
<[[../#Signal Processing Atoms|SP-atoms]]>
<!-- AN, 2.5.2011 -->
<!-- AN, 2.5.2011 -->
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
====ZEROCROSS - zerocrossing rate====
=====Usage:=====
<code>ZEROCROSS <var>x</var> <var>sr</var> <var>xmin</var> <var>type</var></code>
=====Inputs:=====
{|
|-
|
|
|
|-
|x
|signal
|-
|sr
|sampling rate in Hz
|-
|xmin
|threshold
|0 (default)
|-
|type
|output value type (<code>Density</code> | <code>Frequency</code> | <code>Period</code>)
|}
=====Outputs:=====
{|
|-
|y
|number of zero crossings
|}
=====Function:=====
In this atom the zero crossings per second are counted, i.e. the points where between the last counted point and the current point, there exists a value xprev >= xmin and the current value xcurr<= 0 or xprev <= <var>xmin</var> and the current value is xcurr >= 0.
So if <var>xmin</var> = 0 all zero crossings, i.e. changes of signs, are counted. If <var>xmin</var> > 0 the signal has to exceed a certain absolute value if another point is to be counted.

Latest revision as of 12:30, 9 May 2011

Compute zero crossing rate.

[SPU ZEROCROSS X SR XMIN TYPE OUT Y]

input description data type value type default value
X signal vector vector variable
SR sampling rate in Hz number constant 1
XMIN signal amplitude threshold number constant 0
TYPE type of output value
(DENSITY, FREQUENCY, PERIODE, COUNT)
number (int.), string 0 (= DENSITY)
output description data type value type comment
Y zero crossing rate converted to the selected value number variable
Description

In this atom the zero crossings Z of the signal X are counted and than converted to the value selected by TYPE. If XMIN=0 all zero crossings, i.e. changes of signs, are counted. If XMIN>0 the absolute signal magnitude has to exceed this value between two zero crossings. To get more exact density, frequency and periode values, also the index (position) of the first (I1) and last (IN) zero crossing is computed.


TYPE Y description
0 or DENSITY {\displaystyle density=SR\cdot {\frac {Z-1}{I_{N}-I_{1}+1}}} number of zero crossings per second
1 or FREQUENCY {\displaystyle frequency={\frac {density}{2}}={\frac {SR}{2}}\cdot {\frac {Z-1}{I_{N}-I_{1}+1}}} frequeny in Hz
2 or PERIODE {\displaystyle periode={\frac {2}{density}}={\frac {2}{SR}}\cdot {\frac {I_{N}-I_{1}+1}{Z-1}}} periode duration in seconds
3 or COUNT {\displaystyle count=Z\!} number of zero crossings

Note: To compute density, frequency or periode, the value of Z (number of zero crossings) must be greater than 1. If Z<2 and TYPE equals DENSITY, FREQUENCY or PERIODE, Y is set to 0.

See also

<SP-atoms>

Navigation menu

Personal tools