13 lines
459 B
Matlab
13 lines
459 B
Matlab
function mse = meanSquaredError(parameter, x, y)
|
|
% Mean squared error between a straight line and data pairs.
|
|
%
|
|
% Arguments: parameter, vector containing slope and intercept
|
|
% as the 1st and 2nd element, respectively.
|
|
% x, vector of the input values
|
|
% y, vector of the corresponding measured output values
|
|
%
|
|
% Returns: mse, the mean-squared-error.
|
|
|
|
mse = mean((y - x * parameter(1) - parameter(2)).^2);
|
|
end
|