Estimate the maximum value among three consecutive values in a vector
조회 수: 7 (최근 30일)
이전 댓글 표시
Jorge Luis Paredes Estacio
2023년 7월 17일
댓글: Jorge Luis Paredes Estacio
2023년 7월 17일
Hello, I need to do some calculation on each value for each vector. For example, the vector A may contain hundreds of acceleration values:
A=[0.18, 0.01, -0.15, 0.08, .25, 0.12, ......]
I need to abtain a new vector which contains the max value of each three consecutive values of the vector like this:
B=[max(0.18,0.01,-0.15), max(0.01, -0.15,0.08), max(-0.15,0.08,0.25) ...... end=length signal(A)]
I would appreciate your help
Best
댓글 수: 0
채택된 답변
the cyclist
2023년 7월 17일
A=[0.18, 0.01, -0.15, 0.08, .25, 0.12];
output = movmax(A,3)
댓글 수: 2
the cyclist
2023년 7월 17일
Note that @Dyuman Joshi's answer illustrates that the movmax function accepts arguments that will affect how you want to handle the endpoints.
추가 답변 (1개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!