📄 actual_error.txt
字号:
// function to calculate the actual error// method : actual_error// arguments : vector, vector, double// return : void// description :// Compute the actual error from the given data points and the estimated// values.//----------------------------------------------------------------public void actual_error( Vector y_estimate, Vector iset, double act_error){// double actual_pt[];// double estimate_pt[]; double error_value; int j = 0; for (int i = 0; (i < y_estimate.size() && j < iset.size() ); i++) { while ( ((MyPoint)y_estimate.elementAt(i)).x < ((MyPoint)iset.elementAt(j)).x ) if ( ( i < y_estimate.size() ) && ( j < iset.size() ) i++; else break; if ( j < iset.size()) { if ( ((MyPoint)y_estimate.elementAt(i)).x == ((MyPoint)iset.elementAt(j)).x ) { // error is - error_value = ((MyPoint)y_estimate.elementAt(i)).y - ((MyPoint)iset.elementAt(j)).y; act_error += error_value * err_value; } if ( ((MyPoint)y_estimate.elementAt(i)).x > ((MyPoint)iset.elementAt(j)).x ) { double y1 = ((MyPoint)y_estimate.elementAt(i)).y; double y2 = ((MyPoint)y_estimate.elementAt(i - 1)).y; double x1 = ((MyPoint)y_estimate.elementAt(i)).x; double x2 = ((MyPoint)y_estimate.elementAt(i - 1)).x; double x_unknown = ((MyPoint)iset.elementAt(j)).x error_value = y2 - ( (x2 - x_unknown) * ( y2 - y1) / (x2 - x1)); act_error += error_value * error_value ; } j++; } } }
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -