0
$\begingroup$

How to get an average of a sinusoidal signal? The frequency of a signal is 50 Hz and could have harmonics, i.e. high THD.

I tried to use exponential moving average with low cut-off frequency (about 1.6 Hz) but is not work. basically the amplitude of the sinusoidal is big and the filter return a small sinusoidal not the average.

A good lowpass filter could work? or I should try a big moving average window? or just sum the values in a period and divide by the samples in that period to get arithmetic average. I need implement it in an embedded system.

$\endgroup$

1 Answer 1

2
$\begingroup$

How to get an average of a sinusoidal signal?

It's 0. Anything sinusoidal integrated over its period is 0, so in the limit of averaging time going to infinity, it's going to be zero.

I'll hence assume you're asking because you have the sum of a constant offset and a sinusoidal signal.

I tried to use exponential moving average with low cut-off frequency (about 1.6 Hz) but is not work. basically the amplitude of the sinusoidal is big and the filter return a small sinusoidal not the average.

That means the low-pass filter you chose (your EWMA) does not have sufficient (for your application) suppression at the frequencies appearing that you want to suppress (in your application).

So, design a better low pass filtr:

A good lowpass filter could work?

Yes, but if this really is a periodic signal of known frequency, something that has strong suppression at multiples of the fundamental suffices; you don't have to be great at suppressing all frequencies above a cutoff, just the ones where there's actual energy.

or I should try a big moving average window?

That is just a specific low-pass. It's usually not a good one, but in this case, with slight windowing, might be quite elegant, because it has frequency response with zeros every multiple of the inverse of its length.

or just sum the values in a period and divide by the samples in that period to get arithmetic average.

That is literally the same as a moving average.

$\endgroup$
5
  • $\begingroup$ When I have a signal with big amplitude I need to normalize to filter? For example: fs = int(32e3) tf = .05 t = np.arange(int(tffs))*(1/fs) A = 115*np.sqrt(2) x = Anp.sin(2*np.pit*50) x1 = Anp.sin(2*np.pit*50) + 0.1 x2 = Anp.sin(2*np.pi*t*50) + 0.59 If I have A=1 the average get the value added. If the A = 115*np.sqrt(2) Looks like the average diverge. $\endgroup$ Mar 19 at 20:41
  • $\begingroup$ no. A filter is a linear system. $\endgroup$ Mar 19 at 20:43
  • $\begingroup$ I'll try to edit my question to add some figures and the methods I tried to use to get the average of a sinusoid. $\endgroup$ Mar 19 at 20:53
  • $\begingroup$ Is this really going to change a lot about my answer? If this is a new question, it'd probably be better to ask it in a new question post! $\endgroup$ Mar 19 at 20:54
  • $\begingroup$ I don't know. Because it's almost the same question. But I'll ask in another post. with code and figures. $\endgroup$ Mar 19 at 21:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.