How do I calculate percentage differences between initial and final values?
Afficher commentaires plus anciens

For an assignment I need to give the percentage difference or change between an initial and final value. It is about a distribution of a 27 city model as in the picture. Is it possible to calculate all those differences with one command? Thanks.
Réponses (2)
Michiel Buijsman
le 26 Fév 2015
Modifié(e) : Michiel Buijsman
le 26 Fév 2015
0 votes
Star Strider
le 26 Fév 2015
Modifié(e) : Star Strider
le 26 Fév 2015
It depends on how you want to define it.
This works:
pct_change = 100*(final-initial)./initial;
This is vectorised, so you can use it with vectors of ‘initial’ and ‘final’.
Catégories
En savoir plus sur NaNs dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!