| CMSIS-DSP Version 1.4.4 CMSIS DSP Software Library

- CMSIS
- CORE
- Driver
- DSP
- RTOS API
- Pack
- SVD

- Main Page
- Usage and Description
- Reference

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Variance Example
Examples

Description:

  Demonstrates the use of Basic Math and Support Functions to calculate the variance of an input sequence with N samples. Uniformly distributed white noise is taken as input.

Algorithm:

  The variance of a sequence is the mean of the squared deviation of the sequence from its mean.

  This is denoted by the following equation:

       variance = ((x[0] - x') * (x[0] - x') + (x[1] - x') * (x[1] - x') + ... + * (x[n-1] - x') * (x[n-1] - x')) / (N-1)

  where, `x[n]` is the input sequence, `N` is the number of input samples, and `x'` is the mean value of the input sequence, `x[n]`.

  The mean value `x'` is defined as:

       x' = (x[0] + x[1] + ... + x[n-1]) / N

Block Diagram:

Variables Description:

  - `testInput_f32` points to the input data
  - `wire1`, `wir2`, `wire3` temporary buffers
  - `blockSize` number of samples processed at a time
  - `refVarianceOut` reference variance value

CMSIS DSP Software Library Functions Used:

  - arm_dot_prod_f32()
  - arm_mult_f32()
  - arm_sub_f32()
  - arm_fill_f32()
  - arm_copy_f32()

Refer arm_variance_example_f32.c