Programmer Guide/SPU Reference/AVR: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
Line 1: Line 1:
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
====AVR - averaging====
Average input <var>X</var> over evaluation cycles.
 
==<code>[SPU SUM <var>X TYP T RS</var> OUT <var>Y</var>]</code>==
=====Usage:=====
{|class="einrahmen"
 
|In:||<var>X</var>||a number, vector or matrix containing the data to be averaged
<code>AVR <var>X</var> <var>TYP</var> <var>T</var> <var>RS</var></code>
| ||<var>TYP</var>||a number or string; defines the averaging method
| ||<var>T</var>||averaging parameter (number); depends on method
| ||<var>RS</var>||reset flag (number)
|Out:||<var>Y</var>||averaged input <var>X</var>; same type as <var>X</var>
|}


=====Inputs:=====
|<var>A<sub>number</sub></var>
 
|<var>Y<sub>number</sub></var>
;<var>X</var>
|<math>Y=A</math>
 
:A number or vector.
 
;<var>TYP</var>
 
:A string or number selecting the averaging method.
 
;<var>T</var>
 
:A number used as parameter for some methods.
 
;<var>RS</var>
 
:Reset input (see the function description).
 
=====Outputs:=====
 
;<var>Y</var>
 
:The ("time") average of <var>X</var> (same type as <var>X</var>).
 
;<var>N</var>
 
:The number of average cycles since the last reset (number).
 
=====Function:=====
 
Compute an average of input <var>X</var>. The averaging is performed across a specified or infinite number of evaluation cycles. If input <var>X</var> is a vector, each element of the vector is "time"-averaged. In the table <var>X</var>(t)/<var>Y</var>(t) is used for the input/output number or one input/output vector element in the evaluation cycle t.
 
Table 5: Averaging and selection methods
 
{|
|-
|value of TYP
|averaging or selection method
|-
|0 or LINEAR
|If T is greater than 0 it is used as number of average cycles:
[[File:1205.png]]Otherwise (<var>T</var>=0) an infinite average period is used:[[File:1206.png]]
|-
|1 or EXPONENTIAL
|[[File:1207.png]]with: k = U1/2 and 0 < T < 1
|-
|-
|2 or MINIMUM
|<var>A<sub>vector</sub></var>
|[[File:1208.png]]
|<var>Y<sub>number</sub></var>
|-
|<math>Y=\sum_{i=0}^{n-1}A[i]</math>
|3 or MAXIMUM
|[[File:1209.png]]
|}
|}
 
with: n = length of <var>A<sub>vector</sub></var>
The input RS can be used to reset the averager when the SPU is restarted. If <var>RS</var> is set to 1 the averager is reinitialised and the cycle counter (t) is set to zero. Note: the <var>RS</var> input is checked only once when the SPU (containing the averager atom) receives the start-command.
;See also:
<[[../#Signal Processing Atoms|SP-atoms]]>
<!-- AN, 2.5.2011 -->

Revision as of 10:42, 6 May 2011

Average input X over evaluation cycles.

[SPU SUM X TYP T RS OUT Y]

In: X a number, vector or matrix containing the data to be averaged TYP a number or string; defines the averaging method T averaging parameter (number); depends on method RS reset flag (number) Out: Y averaged input X; same type as X

|Anumber |Ynumber |{\displaystyle Y=A} |- |Avector |Ynumber |{\displaystyle Y=\sum _{i=0}^{n-1}A[i]} |} with: n = length of Avector

See also

<SP-atoms>

Navigation menu

Personal tools