How can I calculate vector relative errors in percent?

63 ビュー (過去 30 日間)
Ihor
Ihor 2022 年 12 月 4 日
コメント済み: Ihor 2022 年 12 月 4 日
I have to calculated for each vector sample mean ms and variance vs and for
each calculated ms and vs calculate their relative errors in percent. How can I calculate their relative errors in percent?
It would be great if somebody give some examples.

採用された回答

Image Analyst
Image Analyst 2022 年 12 月 4 日
You need to have a reference signal. Note: variance of a signal is not the error of a signal unless the true signal is a constant, which would be a true variance of zero. For example a true noiseless sine wave would have a variance but that is not an error -- it's the true signal.
You can compute the percentage error from your reference signal like this
pctMeans = 100 * abs(refSignal - testSignal) ./ refSignal;
  2 件のコメント
Image Analyst
Image Analyst 2022 年 12 月 4 日
Is your mean and variance over the whole signal, or is a locally varying one by sliding a window along?
Note the signal is either the mean or the variance in my above equation, so
pctMeans = 100 * abs(refSignal - testSignal) ./ refSignal; % On your vector itself
pctVar = 100 * abs(refSignalVar - testSignalVar) ./ refSignalVar; % On the variance of your signal vector.
Ihor
Ihor 2022 年 12 月 4 日
Thank you so much!

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

その他の回答 (1 件)

Torsten
Torsten 2022 年 12 月 4 日
x = rand(100,1);
ms = mean(x);
vs = var(x);
relative_error_ms_in_percent = abs(ms-0.5)/0.5 * 100
relative_error_ms_in_percent = 0.0043
relative_error_vs_in_percent = abs(vs-1/12)/(1/12) * 100
relative_error_vs_in_percent = 4.9800
  1 件のコメント
Ihor
Ihor 2022 年 12 月 4 日
Thank you so much!

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

カテゴリ

Help Center および File ExchangeCorrelation and Convolution についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by