Calculate mean percentage difference from vectors

10 ビュー (過去 30 日間)
Tumelo Maja
Tumelo Maja 2018 年 10 月 28 日
回答済み: Image Analyst 2018 年 10 月 28 日
I have two vectors
A = [0.0867 0.2838 0.2586 NaN 0.2550 0.5621 0.3236]
B = [0.2212 0.3587 0.7341 0.6815 0.4522 1.3072 0.6816]
I would like calculate the mean percentage difference
I.e. desired outcome : "B over(under)estimate A by 14%" and "B is greater(or less) than A 70% over length(A)"
mean_diff = some_function(A,B) = 14 (in %)
  2 件のコメント
madhan ravi
madhan ravi 2018 年 10 月 28 日
What’s your dersired result of the above ? Give an example of your output.
Tumelo Maja
Tumelo Maja 2018 年 10 月 28 日
See the bottom line

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

回答 (1 件)

Image Analyst
Image Analyst 2018 年 10 月 28 日
Did you try
mean((B - A) ./ A - 1, 'omitnan')
??? It gives 0.1432. It sounds a lot like homework so in case it is, I'll let you finish making it into a function and using an if statement and fprintf() to print out the desired ""B over(under)estimat ....." string.

カテゴリ

Help Center および File ExchangeLogical についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by