MATLAB Answers


Calculate percentage difference between two variables

Muzammil Ali さんによって質問されました 2019 年 8 月 6 日
最新アクティビティ Luna
さんによって 編集されました 2019 年 8 月 6 日
I want to calculate percentage difference between measured and calculated variables along the time axis. Both measured and preducted variables are arrays of different size. I want to calculate the percentage error for the corresponding time.

  3 件のコメント

percentage_error = abs(1-predicted/measured) * 100 ?
100 * ( predicted - measured ) / measured
Thank you for your answer. Yes, this is what I want but it will not work as size of the array predicted is different from size of array measured. And hence predicted(xx) is not at the same time as measured(xx).

サインイン to comment.

1 件の回答

Answer by Luna
on 6 Aug 2019
Edited by Luna
on 6 Aug 2019
 Accepted Answer

You should resample one array's elements according to other array's time.
Check the below function for this:
After resampling your 2 arrays will be the same size. You can substract.

  0 件のコメント

サインイン to comment.

Translated by