Help - Search - Members - Calendar
Full Version: How to model such a filter?
Modelica Forum > Modelica > Modelica
daniel@ka
Hi forum,

I am looking for a way to model a mathematical relationship
y(t) = 1/T* integral over x(tau) dtau from t-T to t
Actually it should yield moving average of x function.

One way I can think of is to transform it manually into
y'(t) = x(t) - x(t-T)

All variables in modelica are function of times, but I think
there is no way to express x(t-T).

Regards, daniel
daniel@ka
QUOTE(daniel@ka @ Apr 11 2009, 06:38 PM) *

Hi forum,

I am looking for a way to model a mathematical relationship
y(t) = 1/T* integral over x(tau) dtau from t-T to t
Actually it should yield moving average of x function.

One way I can think of is to transform it manually into
y'(t) = x(t) - x(t-T)

All variables in modelica are function of times, but I think
there is no way to express x(t-T).

Regards, daniel


I found the rigth solution wink.gif
The solution is to use delay function!

model MA
input Real x;
output Real y;
parameter Real T = 1;
parameter Real y0 = 1;
equation
der(y) = x - delay(x,T);
initial equation
y = y0;
end MA;
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2012 Invision Power Services, Inc.