Programmer Guide/SPU Reference/ZEROCROSS: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
Compute zero crossing rate.
==<code>[SPU ZEROCROSS <var>X SR XMIN TYPE</var> OUT <var>Y</var>]</code>==
{|class="einrahmen"
!input !!description !!data type !!value type!!default value
|-
|<var>X</var>||signal vector||vector ||variable ||
|-
|<var>SR</var>||sampling rate in Hz||number||constant||<code>1<code>
|-
|<var>XMIN</var>||signal amplitude threshold||number||constant ||<code>0</code>
|-
|<var>TYPE</var>||type of output value<BR>(<code>DENSITY, FREQUENCY, PERIODE, COUNT</code>)||number (int.), string||<code>0</code> (= <code>DENSITY</code>)
|-
!output !!description !!data type !!value type!!comment
|-
|<var>Y</var>||zero crossing rate converted to the selected value||number||variable
|}
;Description:
{|class="einrahmen"
!output !!<var>NORM</var>=<code>0</code> !!<var>NORM</var>=<code>1</code> !!description
|-
|<var>M1</var>
|<math>\mu\!</math>
|<math>\mu\!</math>
|mean: <math>\mu = \frac{\sum_{i=0}^{N-1} x_i px_i}{\sum_{i=0}^{N-1} px_i}</math>
|-
|<var>M2</var>
|<math>V\!</math>
|<math>\frac{V}{\mu}</math>
|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>
|<math>S\!</math>
|<math>\frac{S}{\sqrt{V^3}}</math>
|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>
|<math>K\!</math>
|<math>\frac{K}{V^2}</math>
|kurtosis: <math>K = \frac{\sum_{i=0}^{N-1}(x_i-\mu)^4px_i}{\sum_{i=0}^{N-1} px_i}</math>
|}
;See also:
<[[../#Signal Processing Atoms|SP-atoms]]>
<!-- AN, 2.5.2011 -->
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
====ZEROCROSS - zerocrossing rate====
====ZEROCROSS - zerocrossing rate====

Revision as of 12:05, 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
output NORM=0 NORM=1 description
M1 {\displaystyle \mu \!} {\displaystyle \mu \!} mean: {\displaystyle \mu ={\frac {\sum _{i=0}^{N-1}x_{i}px_{i}}{\sum _{i=0}^{N-1}px_{i}}}}
M2 {\displaystyle V\!} {\displaystyle {\frac {V}{\mu }}} variance: {\displaystyle \sigma ^{2}=V={\frac {\sum _{i=0}^{N-1}(x_{i}-\mu )^{2}px_{i}}{\sum _{i=0}^{N-1}px_{i}}}}
M3 {\displaystyle S\!} {\displaystyle {\frac {S}{\sqrt {V^{3}}}}} skewness: {\displaystyle S={\frac {\sum _{i=0}^{N-1}(x_{i}-\mu )^{3}px_{i}}{\sum _{i=0}^{N-1}px_{i}}}}
M4 {\displaystyle K\!} {\displaystyle {\frac {K}{V^{2}}}} kurtosis: {\displaystyle K={\frac {\sum _{i=0}^{N-1}(x_{i}-\mu )^{4}px_{i}}{\sum _{i=0}^{N-1}px_{i}}}}
See also

<SP-atoms>


ZEROCROSS - zerocrossing rate

Usage:

ZEROCROSS x sr xmin type

Inputs:
x signal
sr sampling rate in Hz
xmin threshold 0 (default)
type Frequency | Period)
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 <= xmin and the current value is xcurr >= 0.

So if xmin = 0 all zero crossings, i.e. changes of signs, are counted. If xmin > 0 the signal has to exceed a certain absolute value if another point is to be counted.

Navigation menu

Personal tools