How do you calculate percentage change between sequential elements in array?

8 vues (au cours des 30 derniers jours)
txvmi07
txvmi07 le 20 Juin 2014
Commenté : txvmi07 le 20 Juin 2014
I have a 14400x11 array of values from the output of a hyperbolic function and want to calculate the sequential percentage change from, for example, the first element in the first row and column a(i,j) to the second element in the second row and first column a(i+1,j). How can I do this?

Réponse acceptée

A Jenkins
A Jenkins le 20 Juin 2014
X=rand(3,4)
percent_change=diff(X)./X(1:end-1,:)

Plus de réponses (1)

dpb
dpb le 20 Juin 2014
pct=100*diff(a(:,1))./a(1:end-1,1);

Catégories

En savoir plus sur Operators and Elementary Operations dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by