Percentage Difference of Values stored in Two Matrices

10 vues (au cours des 30 derniers jours)
Mike Scott
Mike Scott le 4 Déc 2014
Commenté : Ghazi Omairi le 11 Fév 2022
I have two 40X1 matrices with values in for which I wish to calculate the percentage difference ie. the difference between the first two values, second two values in each etc.
temperature = matrix 1 analtemp = matrix 2
When trying to do a straight forward percentage difference calculation the variable is displayed as a 40X40 matrix with nothing in it:
PDif=100*((temperature-analtemp)/analtemp);
However, it will allow me to calculate the difference (not percentage) between the two as follows:
Dif=temperature-analtemp;
I cannot understand why this is occurring. Is anyone able to offer some assistance?
Thanks

Réponse acceptée

Azzi Abdelmalek
Azzi Abdelmalek le 4 Déc 2014
PDif=100*(temperature-analtemp)./analtemp;
  4 commentaires
Mike Scott
Mike Scott le 4 Déc 2014
I see. Thanks for your help!
Ghazi Omairi
Ghazi Omairi le 11 Fév 2022
thank you

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Creating and Concatenating Matrices 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