Archived OpenModelica forums. Posting is disabled.

Alternative forums include GitHub discussions or StackOverflow (make sure to read the Stack Overflow rules; you need to have well-formed questions)


Forgot password? | Forgot username? | Register

Mean Value Of a Signal

Mean Value Of a Signal

Hello all,

Does anyone know how can I get the mean value of a continuous signal? For example, there is a function F(t)=x(t). I want to get the mean value of the points: t=0 x(t)=0, t=1 x(t)=1, t=2 x(t)=2. The mean value is (0+1+2)/3=1. How can I find in Modelica?

Best regards.

Re: Mean Value Of a Signal

The sum of a continuous signal is the integration.  So, you can use Modelica.Blocks.Continuous.Integrator to get that sum.  Then, divide by t to get the average.

Re: Mean Value Of a Signal

Thank you, dersh. But it gives me time varying data, but a want a constant single value. How can I obtain that?

Re: Mean Value Of a Signal

The mean of a time varying signal is going to be time varying.  So, I really don't understand what you are looking for.  Can you explain more of what you want?

Re: Mean Value Of a Signal

Yes you are right, but I want to take samples from the time variyng signal for example: t=0 x(t)=0, t=1 x(t)=1, t=2 x(t)=2 and the mean value is (0+1+2)/3=1. How can I obtain the constant mean value?

Re: Mean Value Of a Signal

You can take your continuous signal, then pass it through Modelica.Blocks.Continuous.Sampler then integrate it.  Between each sample the value will be constant, but the integral will increase.  But, when you divide by the time, you should be able to correct that out.  You can also then use sampler again after, if you want it not to change. 

Re: Mean Value Of a Signal

Here's an example of the sum of a random variable:

sampling-test.mo

Attachments:

Re: Mean Value Of a Signal

Thank you dersh  current/smile

There are 0 guests and 0 other users also viewing this topic