【问题标题】:How to calculate 'compare' funtion in Matlab如何在 Matlab 中计算“比较”函数
【发布时间】:2019-07-16 02:36:27
【问题描述】:

我正在研究均方根误差 (RMSE) 和归一化均方根误差 (NRMSE)。

根据Wikipedia's articleMatlab's function

为什么 Wikipedia 手动的 NRMSE 和 MATLAB 的 compare 代码的 NRMSE 的 NRMSE 值不同?

你能教我如何数学计算compare函数吗?

例如,我做了如下。维基百科的方法:

Vt = 1:11;
V1 = [11.5 7.6 6.7 8.3 7.7 7.4 6.5 5.6 6.6 11.2 11.9]; % obseved data
V2 = [11.9 10.8 8.3 9.6 11.4 10.2 12.4 9.6 8.3 8 9]; % estimationd data
RMSE = sqrt(mean((V1-V2).^2)); % RMSE = 3.14107
NRMSE = RMSE/(max(V2)-min(V2)) % NRMSE = 0.71

MATLAB的比较内部函数:

% to use compare
VV1 = iddata(V1', Vt');
VV2 = iddata(V2', Vt');
compare(VV1,VV2) % -48.46%

【问题讨论】:

    标签: matlab mean-square-error


    【解决方案1】:

    根据compare文档,Matlab对NRMSE的估计和你的不一样。

    您需要知道计算 RMSE 和 NRMSE 的方法有很多种。来自您在Root-mean-square deviation 上链接的维基百科文章:

    文献中没有一致的标准化方法

    你选择了一种方式,而 Matlab 有另一种方式。

    所以如果你想匹配 Matlab 的结果,你应该这样做:

    NRMSE = 100*(1 - norm(V1-V2)/norm(V1-mean(V1)))
    [y,fit,x0] =compare(VV1,VV2); fit
    

    返回

     NRMSE =
      -48.4595
    
     fit =
      -48.4595
    

    【讨论】:

    • 你太棒了,非常感谢
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多