필터 지우기
필터 지우기

Mean of elements of a vector

조회 수: 1 (최근 30일)
Sean O'Donnell
Sean O'Donnell 2019년 3월 27일
댓글: Sean O'Donnell 2019년 3월 28일
I have a vector K = [1.7135 3.2725 4.0000 3.2725 1.7135 0.4775 0.0365 0 0.0365 0.4775]. How do I take the mean of all of the sets of two sequential elements of this vector without using a "for" loop? Example: Mean of K(1) and K(2), K(2) and K(3), K(3) and K(4) etc. And then put all of those individual means into a single vector?
Thanks.
  댓글 수: 2
Walter Roberson
Walter Roberson 2019년 3월 27일
Sounds like homework.
Hint: A(1:end-1) and A(2:end)
Sean O'Donnell
Sean O'Donnell 2019년 3월 28일
This worked. Thank you!

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

답변 (1개)

Rik
Rik 2019년 3월 27일
Use a convolution.
conv(data,[0.5 0.5])
should be a good start.

카테고리

Help CenterFile Exchange에서 Pulsed Waveforms에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by