I have the ideal point (500,700) and the calculated point (499.79,700.44). I want to calculate the error but i can't. Please help me out
显示 更早的评论
clc
clear
Idealpoint=(500,700)
calculatedpoint=(499.79,700.44)
error=?
4 个评论
José-Luis
2014-6-11
What's the error function? Absolute error? Squared error? Separately for x and y?
Mehedi
2014-6-11
What have you tried so far? If you would like to learn how to perform basic arithmetics in Matlab, please refer to the "Getting started" part of the documentation.
absolute_error = abs((observed - simulated) ./ observed) .* 100
Mehedi
2014-6-11
回答(2 个)
José-Luis
2014-6-11
absolute_error = mean(abs((observed(:) - simulated(:)) ./ observed(:)) .* 100)
Star Strider
2014-6-12
How I would do it:
Idealpoint = [500,700];
calculatedpoint=[499.79,700.44];
pct_abs_err = 100 * abs((Idealpoint-calculatedpoint)./Idealpoint)
produces:
pct_abs_err =
42.0000e-003 62.8571e-003
2 个评论
Mehedi
2014-6-12
Star Strider
2014-6-12
The usual practice is to calculate the error for each one.
If you want the combined error, I suppose taking the mean of both would work:
pct_abs_err = mean(100 * abs((Idealpoint-calculatedpoint)./Idealpoint))
类别
在 帮助中心 和 File Exchange 中查找有关 Mathematics 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!