-
FlexPro
- Auf einen Blick
- Features & Optionen
- Einsatzgebiete
- Alle Vorteile
- Neu in FlexPro 2021
- FlexPro gratis testen
- FlexPro View OEM Freeware
- Kaufberatung
- Login
- Language
- +49 6894 929600
- infoweisang.com
- Google Maps
- Produkte
- News
- Support
- Unternehmen
- Jobs
- Kontakt
- Login
- Language
- +49 6894 929600
- infoweisang.com
- Google Maps
Home > Community > FPScript > calculate the true RMS value > Antwort auf: calculate the true RMS value
Februar 21, 2013 um 9:13 am Uhr
#9273
Bernhard Kantz
Teilnehmer
The RMS value is a mean value, for a good estimation it is sufficient to average over enough full periods of the signal.
To compute the RMS over single periods, one can use the FPScript function LevelCrossings() to determine the indices of upward zero crossings as boundaries in the signal to compute one RMS value per period.
// indices of upward zero crossings (with 5 % hysteresis)
Dim idx = LevelCrossings(IA, 0, 0.05 * Range(IA), EVENT_POSITIVE, EVENT_INDEX)
// prepare output datasets in the desired length
Dim rms_y = IA.Y[0L] # Shape(idx[1L,-1L])
Dim rms_x = IA.X[0L] # Shape(idx[1L,-1L])
Dim i_begin, i_end
For Each Row i In idx[1L,-1L] Do
// extract a full period
i_begin = idx
i_end = idx - 1L
// use x (time) of the interval center
rms_x = IA.X[(i_begin + i_end) / 2L]
rms_y = Mean(IA[i_begin, i_end], MEAN_SQUARE)
End
Signal(rms_y, rms_x)