### Author Topic: question about calculating true rms on non-linear signals  (Read 4550 times)

0 Members and 1 Guest are viewing this topic.

#### Psi

• Super Contributor
• Posts: 9828
• Country:
##### question about calculating true rms on non-linear signals
« on: April 07, 2011, 11:32:18 am »
I have a microcontrollers adc channel connected to a current sensor, however this sensors output voltage is not linear to current. This isn't so much of a problem as i have the formula to correct the response of the sensor and produce accurate current values.

What i want to know is if i can sample and calculating the RMS value of the raw non-linear sensor output and then convert this rms value to rms current using the formula later on.

Does anyone know if that will work?

I know it will work if i use the formula first and then do the RMS calculations on the true current values but i want to know if it will work the other way around.
« Last Edit: April 07, 2011, 11:37:04 am by Psi »
Greek letter 'Psi' (not Pounds per Square Inch)

#### ziq8tsi

• Regular Contributor
• Posts: 80
##### Re: question about calculating true rms on non-linear signals
« Reply #1 on: April 07, 2011, 05:31:30 pm »
What i want to know is if i can sample and calculating the RMS value of the raw non-linear sensor output and then convert this rms value to rms current using the formula later on.

No, rms(f(x)) is not generally expressible as g(rms(x)) for any function g.  If it was we could take f as sqrt, and then calculate rms in terms of the (absolute) mean.

You might be able to save work by moving some linear parts of the function out of the rms, or by simplifying the function at the expense of some accuracy.  But probably your best chance, if the function is slow, is a lookup table on the adc output values.

#### Psi

• Super Contributor
• Posts: 9828
• Country:
##### Re: question about calculating true rms on non-linear signals
« Reply #2 on: April 08, 2011, 06:47:38 am »
yeah, i suspected that might be the case

thanks for your help
Greek letter 'Psi' (not Pounds per Square Inch)

#### scrat

• Frequent Contributor
• Posts: 608
• Country:
##### Re: question about calculating true rms on non-linear signals
« Reply #3 on: April 11, 2011, 02:46:59 pm »
If you know the formula, you could integrate and calculate its sqrt analytically, then apply the obtained formula on the MCU.
One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man. - Elbert Hubbard

#### Mechatrommer

• Super Contributor
• Posts: 11413
• Country:
• reassessing directives...
##### Re: question about calculating true rms on non-linear signals
« Reply #4 on: April 12, 2011, 12:10:23 pm »
LMGTFY... RMS d' WIKI, check under the discrete section and formulation. its possible i think.

Nature: Evolution and the Illusion of Randomness (Stephen L. Talbott): Its now indisputable that... organisms “expertise” contextualizes its genome, and its nonsense to say that these powers are under the control of the genome being contextualized - Barbara McClintock

#### ziq8tsi

• Regular Contributor
• Posts: 80
##### Re: question about calculating true rms on non-linear signals
« Reply #5 on: April 13, 2011, 09:26:29 am »
If you know the formula, you could integrate and calculate its sqrt analytically, then apply the obtained formula on the MCU.

I do not think that you have thought that through.  You have certainly not explained how it might help.

The thing you would need to integrate would be the square of the result of applying the transfer function to the discrete time series sample data.  You can not helpfully analyse this before you know what the data are.

The only case where the integral of the (square of the) transfer function alone could be useful is if the samples happened to form a straight line.  But then they do not cover an entire period of the waveform, and the RMS value is of no significance.

LMGTFY... RMS d' WIKI, check under the discrete section and formulation. its possible i think.

You are just waving your arms.

#### scrat

• Frequent Contributor
• Posts: 608
• Country:
##### Re: question about calculating true rms on non-linear signals
« Reply #6 on: April 13, 2011, 10:11:39 am »
If you know the formula, you could integrate and calculate its sqrt analytically, then apply the obtained formula on the MCU.

I do not think that you have thought that through.  You have certainly not explained how it might help.

The thing you would need to integrate would be the square of the result of applying the transfer function to the discrete time series sample data.  You can not helpfully analyse this before you know what the data are.

The only case where the integral of the (square of the) transfer function alone could be useful is if the samples happened to form a straight line.  But then they do not cover an entire period of the waveform, and the RMS value is of no significance.

You're right. I was thinking of finding the relationship between the two rms values in the form , but even for a simple polynomial function it isn't that simple, and involves at least the calculation of some other integrals (of the acquired values elevated to powers), which makes it, in the best case, useless.
One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man. - Elbert Hubbard

#### Mechatrommer

• Super Contributor
• Posts: 11413
• Country:
• reassessing directives...
##### Re: question about calculating true rms on non-linear signals
« Reply #7 on: April 13, 2011, 08:28:09 pm »
LMGTFY... RMS d' WIKI, check under the discrete section and formulation. its possible i think.
You are just waving your arms.