This function implements an adaptive normalization method on a given respiratory signal.

adanorm(x, sRate)

## Arguments

x

Numeric vector representing the input signal to be normalized.

sRate

Integer value representing the sampling rate of the signal (number of samples per second).

## Value

Numeric vector representing the adaptively normalized signal.

## Details

It is designed to preserve the parts of the signal where the amplitude of respiration is small, typically when the body maintains a sleeping posture for extended periods.

Adaptive normalization first segments the signal into 1 second window before computing $$A(k)$$ and is based on the following equations:

Equation (1) - Mean absolute deviation: $$A(k) = \frac{1}{fs} \sum_{i=k \cdot fs}^{(k+1) \cdot fs - 1} \left| x(i) \right|$$

Equation (2) - Standard deviation: $$\sigma(k) = \sqrt{\frac{1}{fs-1} \sum_{i=k \cdot fs}^{(k+1) \cdot fs - 1} (x(i) - \bar{x}(k))^2}$$

Equation (3) - Adaptive normalization factor, initialized to 1. $$F_{\text{norm}}(k) = \min\left(0.95F_{\text{norm}}(k-1) + 0.05A(k), 0.95F_{\text{norm}}(k-1) + 0.05\sigma(k)\right)$$