summation

조회 수: 3 (최근 30일)
harish bharadwaj
harish bharadwaj 2011년 5월 24일
hi,
how to calculate summation of absolute value of incoming digital data over a cycle period for example 64 samples in a cycle using matlab or simulink
∑abs|d1(k)| for k=0 to 64

답변 (2개)

Laura Proctor
Laura Proctor 2011년 5월 24일
d = randn(64,1);
s = sum(abs(d))
  댓글 수: 1
Lisa Justin
Lisa Justin 2012년 2월 22일
what about the interval?

댓글을 달려면 로그인하십시오.


MarkB
MarkB 2011년 5월 24일
There are a couple options available:
  • You could chain a series of 64 unit delays together and run a branched signal off of each one into a summation block.
  • You could use MATLAB function block ("Embedded MATLAB" in older releases) and have something in the body like:
function y = avg64( u )
persistent x;
if( isemtpy( x ) == true )
x = zeros( 64, 1 );
end
x = [ abs(u), x( 2 : end ) ];
y = x;
return;
end
  • I believe that the communication blockset has some buffer blocks that will accumulate a rolling set of samples, which you could then feed to a sum block.
  • There is probably a way to write this as a transfer function too.

카테고리

Help CenterFile Exchange에서 General Applications에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by