Skip to content

Algorithms | latest | shape-factor

Shape factor

The shape factor is defined as the ratio of the RMS value and the mean of absolute values.

ShapeFactor=1Ni=0N1x[i]21Ni=0N1|x[i]|

References

Code

INFO

The following snippet is written in a generic and unoptimized manner. The code aims to be comprehensible to programmers familiar with various programming languages and may not represent the most efficient or idiomatic Python practices. Please refer to implementations for optimized implementations in different programming languages.

py
import numpy as np


def shape_factor(signal: np.ndarray) -> float:
    return np.sqrt(np.mean(signal**2)) / np.mean(np.abs(signal))
Run in playground