peak2rms
The ratio of the peak value to the RMS value.
| Library |
|
Arguments
Input arguments
# x — input signal
+
vector | the matrix | An N-dimensional array
Details
An input signal specified as a vector, matrix, or multidimensional array.
| Типы данных |
|
| Support for complex numbers |
Yes |
# dim — the measurement for which the operation is performed
+
scalar
Details
The dimension that the operation is performed on, specified as a positive integer scalar. By default peak2rms works with the first dimension of the array x a dimension greater than 1. For example, if x — row vector or column vector, then y — a real scalar. If x — a matrix of dimension on , where Then y — vector is a string of dimension 1 on , containing the ratio of the peak value to the RMS value of the columns y.
| Типы данных |
|
Output arguments
# y is the ratio of the peak value to the RMS value
+
scalar | the matrix | An N-dimensional array
Details
The ratio of the peak value to the RMS value, returned as a real scalar, matrix, or multidimensional array.
Examples
The ratio of the peak value to the RMS value for a sine wave
Details
Calculate the ratio of the peak value to the RMS value for 100 Hz sinusoids with sampling frequency 1 kHz.
import EngeeDSP.Functions: peak2rms
t = range(0, stop=1-0.001, step=0.001)
x = cos.(2*pi*100*t)
y = peak2rms(x)
println("y = ", y)
y = 1.414213562373095
The ratio of the peak value to the RMS value for a two-dimensional matrix
Details
Let’s create a matrix in which each column represents a sinusoid with frequency 100 Hz, sampled with frequency 1 kHz, with different amplitudes. The amplitude is equal to the column index.
Calculate the ratio of the peak value to the RMS value of the columns.
import EngeeDSP.Functions: peak2rms
t = 0:0.001:1-0.001
x = cos.(2*pi*100*t) .* (1:4)'
y = peak2rms(x)
println("y = ", y)
y = [1.414213562373095 1.414213562373095 1.4142135623730945 1.414213562373095]
The ratio of the peak value to the RMS value for a two-dimensional matrix along a given dimension
Details
Let’s create a matrix in which each row represents a sinusoid with frequency 100 Hz, sampled with frequency 1 kHz, with different amplitudes. The amplitude is equal to the row index.
Calculate the ratio of the peak value to the RMS value of the columns, specifying the dimension equal to 2, using the argument dim.
import EngeeDSP.Functions: peak2rms
t = 0:0.001:1-0.001;
x = (1:4) .* cos.(2*pi*100*t)';
y = peak2rms(x, 2)
1.4142135623730934
1.4142135623730934
1.4142135623730963
1.4142135623730934