#

**1**
Forum Advisor

**1,515,**

**538**

Join Date: Jan 2013

Last Activity: 16 June 2019, 4:56 PM EDT

Location: Loughborough

Posts: 1,515

Thanks Given: 626

Thanked 538 Times in 384 Posts

**Simple symmetrical wave RMS DEMO using awk.**

Hi everyone.

This is DEMO code for getting the RMS value of a symmetrical sampled waveform. It works a treat except see below.

I have used awk as the prime mover as CygWin does not havd 'bc' or 'dc' yet and this is going into AudioScope.sh soon.

However, I hit an anomaly.

In the code below parts B, C, D and G are more than acceptable and E was as expected and also within limits acceptable.

However I never expected this, assume the waveform starts at centreline 0V...

View part F in the code and using just 4 samples with the input waveform being an isosceles triangle then a stepped squarewave becomes the sample.

(The results on editing each waveform are in the code.)

As far as I am concerned there is no way of the sample knowing that the original signal was

either a sinewave or a triangle wave but the RMS result is that of a sinewave.

I can't find anything on a sample size of 4 on a triangle waveform and and its inversion so this anomaly stays.

Bazza.

This is DEMO code for getting the RMS value of a symmetrical sampled waveform. It works a treat except see below.

I have used awk as the prime mover as CygWin does not havd 'bc' or 'dc' yet and this is going into AudioScope.sh soon.

However, I hit an anomaly.

In the code below parts B, C, D and G are more than acceptable and E was as expected and also within limits acceptable.

However I never expected this, assume the waveform starts at centreline 0V...

View part F in the code and using just 4 samples with the input waveform being an isosceles triangle then a stepped squarewave becomes the sample.

(The results on editing each waveform are in the code.)

As far as I am concerned there is no way of the sample knowing that the original signal was

either a sinewave or a triangle wave but the RMS result is that of a sinewave.

I can't find anything on a sample size of 4 on a triangle waveform and and its inversion so this anomaly stays.

Bazza.