필터 지우기
필터 지우기

Moving average with reducing sampling

조회 수: 2 (최근 30일)
Omar Aljanaideh
Omar Aljanaideh 2017년 11월 30일
편집: Omar Aljanaideh 2017년 11월 30일
The following is a moving average filter that uses an average of 50 samples of input signal using embedded matlab function. Beside this, How can i reduce the number of samples of output. i.e: after i get the averaged output y, how i get only one averaged value from each 100 averaged samples of y, Such that if i will reduce the sampling of the signal will be changed, if the sampling at input is 1 ms, at output will be 100 ms the output port.
function y = my_average(u) %# codegen
persistent i buf bufSum;
if isempty(buf)
buf = zeros(1,50);
bufSum = 0;
i = 1;
end
bufSum = bufSum - buf(i);
buf(i) = u;
bufSum = bufSum + u;
i = i + 1;
if i > numel(buf)
i = 1;
end
y = bufSum / numel(buf);

답변 (0개)

카테고리

Help CenterFile Exchange에서 Matched Filter and Ambiguity Function에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by