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