Engee documentation

rssq

The root of the sum of squares.

Library

EngeeDSP

Syntax

Function call

  • y = rssq(x) — returns the root of the sum of squares (RSS) of the input signal x. If x — row vector or column vector, then y — real scalar. If x has more than one dimension, then rssq works with the first dimension of the array, the size of which is larger 1.

  • y = rssq(x, dim) — calculates the root of the sum of squares of the input signal x by measurement dim.

Arguments

Input arguments

# x — input signal

+ vector | the matrix | N-dimensional array

Details

An input signal specified as a vector, matrix, or multidimensional array.

Типы данных

Float32, Float64

Support for complex numbers

Yes

# dim — the measurement by which the operation is performed

+ scalar

Details

The dimension on which the operation is performed, specified as a positive integer scalar.

Типы данных

Float32, Float64

Output arguments

# y is the root of the sum of squares

+ scalar | vector | the matrix | N-dimensional array

Details

The root of the sum of squares returned as a real scalar, vector, matrix, or multidimensional array.

Examples

The root of the sum of the squares of the sine wave

Details

Calculate the root of the sum of the squares of the sine wave frequency 100 Hz, sampled with frequency 1 kHz.

import EngeeDSP.Functions: rssq

t = range(0, stop=1-0.001, step=0.001)
x = cos.(2*pi*100*t)
y = rssq(x)

println("y = ", y)
y = 22.360679774997898

The root of the sum of squares of a two-dimensional matrix

Details

Let’s create a matrix in which each column represents a sine wave with a frequency 100 Hz, sampled with frequency 1 kHz, with different amplitudes. The amplitude is equal to the column index.

Calculate the root of the sum of the squares of each column.

import EngeeDSP.Functions: rssq

t = 0:0.001:1-0.001
x = cos.(2*pi*100*t) .* (1:4)'
y = rssq(x)

println("y = ", y)
y = [22.360679774997898 44.721359549995796 67.0820393249937 89.44271909999159]

The root of the sum of squares of a two-dimensional matrix along a given dimension

Details

Let’s create a matrix in which each line is a sine wave with a frequency of 100 Hz, sampled at a frequency of 1 kHz, with different amplitudes. The amplitude is equal to the row index.

Calculate the root of the sum of squares for the rows, specifying the dimension using the argument dim.

import EngeeDSP.Functions: rssq

t = 0:0.001:1-0.001
x = (1:4) .* cos.(2*pi*100*t)'

y = rssq(x, 2)
4×1 Matrix{Float64}:
 22.360679774997923
 44.721359549995846
 67.08203932499363
 89.44271909999169

Additional information

The root of the sum of squares

Details

The root of the sum of squares (RSS) is defined as

with summation over a given dimension. The RSS value is also called the second norm.

Literature

  1. IEEE® Standard on Transitions, Pulses, and Related Waveforms, IEEE Standard 181, 2003.