Difference Calculation between current value and a specified prior value
조회 수: 1 (최근 30일)
이전 댓글 표시
Hello,
I use the following to calculate percentage change:
B = (diff(VMA)./(VMA(1:end-1))*100;
What this does is (x1 - x2) / x2....
How can i make it where i pick the prior value, for example i want the rate of change but looking back 10 values...therefore:
B = (x1 - x10) / x10
Thanks!
댓글 수: 0
답변 (1개)
David Hill
2022년 1월 19일
Not sure exactly what you are after, an example would be helpful.
B=(x(1:10)-x(10:19))./x(10:19);
참고 항목
카테고리
Help Center 및 File Exchange에서 Get Started with MATLAB에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!