Programmer Guide/SPU Reference/EXSTAT: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(11 intermediate revisions by the same user not shown)
Line 17: Line 17:
|<var>M2</var>||2nd moment (variance or spread)||number||variable  
|<var>M2</var>||2nd moment (variance or spread)||number||variable  
|-  
|-  
|<var>M2</var>||3rd moment (skewness)||number||variable  
|<var>M3</var>||3rd moment (skewness)||number||variable  
|-
|-
|<var>M4</var>||4th moment (kurtosis)||number||variable  
|<var>M4</var>||4th moment (kurtosis)||number||variable  
Line 30: Line 30:
*If <var>PX</var> is not a vector, the probabilies ''px''<sub>i</sub> are set to 1.
*If <var>PX</var> is not a vector, the probabilies ''px''<sub>i</sub> are set to 1.
;Description:
;Description:
<math>begin{matrix}
\mu = \frac{\sum_{i=0}^{N-1} x_i px_i}{\sum_{i=0}^{N-1} px_i} &
\sigma = \frac{\sum_{i=0}^{N-1}(x_i-M1)^2px_i}{\sum_{i=0}^{N-1} px_i} \\
\mu = \frac{\sum_{i=0}^{N-1} x_i px_i}{\sum_{i=0}^{N-1} px_i} &
\sigma = \frac{\sum_{i=0}^{N-1}(x_i-M1)^2px_i}{\sum_{i=0}^{N-1} px_i} \\
end{matrix}</math>
{|class="einrahmen"
{|class="einrahmen"
!output !!<var>NORM</var>=<code>0</code> !!<var>NORM</var>=<code>1</code>
!output !!<var>NORM</var>=<code>0</code> !!<var>NORM</var>=<code>1</code> !!description
|-
|-
|<var>M1</var>
|<var>M1</var>
|<math>\frac{\sum_{i=0}^{N-1} x_i px_i}{\sum_{i=0}^{N-1} px_i}</math>
|<math>\mu\!</math>
|<math>\frac{\sum_{i=0}^{N-1} x_i px_i}{\sum_{i=0}^{N-1} px_i}</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>M1</var>
|<var>M2</var>
|<math>\frac{\sum_{i=0}^{N-1}(x_i-M1)^2px_i}{\sum_{i=0}^{N-1} px_i}</math>
|<math>V\!</math>
|<math>\frac{1}{M1}\frac{\sum_{i=0}^{N-1}(x_i-M1)^2px_i}{\sum_{i=0}^{N-1} px_i}</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>
|-
|}
 
 
This SP-atom applies a non-linear magnitude weighting (= limiter function) to the signal. The limiter function is only applied if the absolute value of the signal magnitude is higher than the specified limiter start magnitude <var>LIM</var>. For the limiter function, the following algorithm is used:
:<math>y_i = \begin{cases}
x_i  & \mbox{ if }|x_i| \leqslant LIM \\
sign(x_i).f \left ( \frac{|x_i|}{MAX} \right ) & \mbox{ otherwise}
\end{cases}
</math>
The absolute magitude of the limited signal is always lower than <var>MAX</var>. The limiter function is selected by the input <var>TYPE</var>.
:{|class="einrahmen"
!<var>TYPE</var> !!limiter function ''f''(''z''<sub>i</sub>)
|-
|<code>0</code> or <code>RECTANGLE</code>
|<math>k\!</math>
|-
|-
|<code>1</code> or <code>ATAN</code>
|<var>M3</var>
|<math>k+(1-k) \cdot \frac{2}{\pi} \cdot atan\left ( \frac{z-k}{1-k} \cdot \frac{\pi}{2} \right )</math>
|<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>
|-
|-
|<code>2</code> or <code>EXPONENTIAL</code>
|<var>M4</var>
|<math>1-(1-k) \cdot e^{-\frac{z-k}{1-k}}</math>
|<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>
|}
|}
:with: <math>z_i = \frac{|x_i|}{MAX}, k = \frac{LIM}{MAX}</math>
The output <var>Q</var> is set to the relative number of limited (changed) samples.
:<math>Q = \frac{changedSamples}{processedSamples}</math>
;See also:
;See also:
<[[../#Signal Processing Atoms|SP-atoms]]>
<[[../#Signal Processing Atoms|SP-atoms]]>
<!-- AN, 2.5.2011 -->
<!-- AN, 2.5.2011 -->

Latest revision as of 11:56, 9 May 2011

Calculation of statistical moments.

[SPU EXSTAT X PX NORM OUT M1 M2 M3 M4 N]

input description data type value type default value
X data vector number, vector variable 0,1,..
PX probability vector number, vector variable 1, 1, ...
NORM normalization flag number (int.), string constant 0 (= NO)
output description data type value type comment
M1 1st moment (mean) number variable
M2 2nd moment (variance or spread) number variable
M3 3rd moment (skewness) number variable
M4 4th moment (kurtosis) number variable
N number of data samples number constant

Note:

  • At least one of the data vectors X and PX must be supplied!
  • The number of data points N is set to the length of the vector X or PX.
  • If X is a not connected, the x-data are initialized with xi = i.
  • If X is a number, the x-data are initialized with xi = X+i.
  • If PX is not a vector, the probabilies pxi are set to 1.
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>

Navigation menu

Personal tools