Percentage Difference of Values stored in Two Matrices

10 ビュー (過去 30 日間)
Mike Scott
Mike Scott 2014 年 12 月 4 日
コメント済み: Ghazi Omairi 2022 年 2 月 11 日
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

採用された回答

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 12 月 4 日
PDif=100*(temperature-analtemp)./analtemp;
  4 件のコメント
Mike Scott
Mike Scott 2014 年 12 月 4 日
I see. Thanks for your help!
Ghazi Omairi
Ghazi Omairi 2022 年 2 月 11 日
thank you

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCreating and Concatenating Matrices についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by