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