plotting RMSE

15 ビュー (過去 30 日間)
dab483
dab483 2012 年 1 月 24 日
Hi,
i am calculating root mean square error (RMSE) of true state(x) and estimated state (xhat)using the equation below:
err=sqrt(sum(x(:,1)-xhat(:,1))^2/numel(x))
this will gave me one answer at the last of simulation time. Now, if i want to plot the RMSE over simulation time, how should i coding it?

回答 (1 件)

bym
bym 2012 年 1 月 25 日
Assuming you are calculating x and xhat in a loop with an index variable(e.g. k), then
err(k)=sqrt(sum(x(1:k,1)-xhat(1:k,1))^2/k);
t(k) = dt*k; %simulation time, where dt is time for one increment of loop
%outside of loop:
plot(err,t)

カテゴリ

Help Center および File ExchangeLinear and Nonlinear Regression についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by