![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/188703/image.png)
Moving average on window of latest inputs with Exponential Weighting method
조회 수: 1 (최근 30일)
이전 댓글 표시
I want to create a subsystem in Simulink that performs moving average with exponential weighting method on a finite-size window of latest inputs.
Currently, the Moving Average block in Simulink performs this task on on the entire input while I wish to perform the moving average with exponential weighting on the 10 most recent elements only.
What is the best way to do this in Simulink? Thanks in advance.
댓글 수: 0
답변 (1개)
Benjamin Großmann
2018년 5월 22일
One possibility is to use the discrete filter block with denominater = [1] and Numerator are the exponential weights. If you do not want some static gain, then the sum of the weights shoul equal 1, e.g.
Numerator = exp(-[1:10])./sum(exp(-[1:10]));
A hand made solution could exist of a tapped delay block which outputs N delays of the input inside a vector. Then you can multiply your weights to this vector and sum up all elements:
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/188703/image.png)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Sources에 대해 자세히 알아보기
제품
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!