Compute cumulative sum of a singal for a certain period of time (moving sum)

조회 수: 11 (최근 30일)
Hello,
I am trying to determine the cumulative sum of signal values over a period of time 't seconds' in a simulink model. After simulation start, for t seconds, the sum has to be cumulative and after t seconds, with each timestep, the oldest value has to be subtracted from the cumulative sum and the latest value has to be added.
Does anyone have a clever idea of implementing it? I have considered using delay blocks, but I have to use numerous blocks. Also considered Integrator and Cumulative sum blocks, but their reset the values set everything to zero and hence, don't fit the above requirement.
Thanks and Regards
Karthik

채택된 답변

Rick Rosson
Rick Rosson 2016년 3월 2일
You can use a Discrete FIR Filter with coefficients of ones(1,N) where N = Fs*t.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Signal Generation에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by