Programmer Guide/SPU Reference/ZEROCROSS: Difference between revisions
From STX Wiki
Jump to navigationJump to search
No edit summary |
|||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
{{DISPLAYTITLE:{{SUBPAGENAME}}}} | {{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 | |||
<code>ZEROCROSS <var> | |- | ||
|<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> | ||
|signal | |||
|- | |- | ||
| | |<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: | |||
{| | 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>>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" | |||
!<var>TYPE</var> !!<var>Y</var> !!description | |||
|- | |- | ||
| | |<code>0</code> or <code>DENSITY</code> | ||
|<math>density=SR\cdot\frac{Z-1}{I_N-I_1+1}</math> | |||
|number of zero crossings per second | |||
|- | |||
|<code>1</code> or <code>FREQUENCY</code> | |||
|<math>frequency=\frac{density}{2}=\frac{SR}{2}\cdot\frac{Z-1}{I_N-I_1+1}</math> | |||
|frequeny in Hz | |||
|- | |||
|<code>2</code> or <code>PERIODE</code> | |||
|<math>periode=\frac{2}{density}=\frac{2}{SR}\cdot\frac{I_N-I_1+1}{Z-1}</math> | |||
|periode duration in seconds | |||
|- | |||
|<code>3</code> or <code>COUNT</code> | |||
|<math>count=Z\!</math> | |||
|number of zero crossings | |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 <var>TYPE</var> equals <code>DENSITY</code>, <code>FREQUENCY</code> or <code>PERIODE</code>, <var>Y</var> is set to 0. | |||
;See also: | |||
<[[../#Signal Processing Atoms|SP-atoms]]> | |||
<!-- AN, 2.5.2011 --> | |||
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
|
number of zero crossings per second | |
1 or FREQUENCY
|
frequeny in Hz | |
2 or PERIODE
|
periode duration in seconds | |
3 or COUNT
|
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>