Reputation: 193
I am trying to average a signal which is coming to my simulink model (unknown initial condition). I can pass on the first value as it is, But the 2nd value must be averaged with the first before passing it on and the must be averaged with the average of first two and so on. Can I just give initial condition as 0 for the first case?
But the problem is the length of the signal is unknown, I can keep getting signal until I run my program. I thought of moving average filter, but not sure how to proceed with this.
If anyone can point me in right direction.
Upvotes: 0
Views: 123
Reputation: 22224
If you have the DSP System Toolbox then can use the Moving Average block. Turn off "Specify window length" to get the cumulative moving average.
Upvotes: 1
Reputation: 35525
You want a Cumulative moving average.
Its equation is quite simple
average=(newpoint+average*npoints)/(npoints+1);
npoits++
Upvotes: 0