# Extracting the DC component of a signal, that proportional to the displacement about the y-axis

I’m not sure that I clearly enough reflected the essence of a small problem in the title of the topic, but I’ll try to reveal its essence in the question itself.

https://www.wolframalpha.com/input/...

We have two signals.

If the signal is shifted more to the positive region (up along the $$y-axis$$), then we "mentally associate the $$+1$$ sign with it, if it is negative (down the $$y-axis$$), then we" mentally associate the $$-1$$ sign with it".

If both the positive and negative regions are approximately the same, then the DC component should be approximately equal to zero.

How is it possible to extract the DC component of the signal proportional to the displacement about the y-axis:

1. Use mathematical functions? If so, which ones?

2. Use filters? If so, which filter to choose to solve this problem?

I am an amateur in signal processing, I began to study this theme not so long ago.

DC component is the zero frequency component. If you look at the DFT expression, this would mean summing up the input. So in mathematical terms this would be the sum (or the running sum) based on your application.

In terms of filtering again this would be an averaging filter. Like moving average.

• I tried the moving average filter and got the following result. Input_Output Moving Average Obviously, the filter itself also needs to be configured. If the dc component is a signal at zero frequency, maybe try filter synthesis, which will firmly cut off all frequencies, just above zero. Is an elliptical filter suitable for this? – dtn Jun 5 '20 at 7:22
• You would need to tweak the length of moving average based on application. I have given a similar answer on a different question, there the question was extracting DC for analog signals...but I have illustrated the digital way as well. dsp.stackexchange.com/questions/66770/… – Dsp guy sam Jun 5 '20 at 7:32
• Is it implementable in Simulink? – dtn Jun 5 '20 at 7:35
• Havnt tried it in simulink, but shouldn't be more than 20 lines of MATLAB code – Dsp guy sam Jun 5 '20 at 7:38
• On the other hand, in Simulibk there are great opportunities for working with filters. Maybe all the same, we may choose one of them (Chebyshev, Butterworth, Elliptical, etc.)? Which one is good for this? – dtn Jun 5 '20 at 7:41