This repository has been archived on 2021-05-17. You can view files and clone it, but cannot push or open issues or pull requests.
scientificComputing/statistics/code/lsq_error.m

6 lines
172 B
Matlab

function error = lsq_error(parameter, x, y)
% parameter(1) is the slope
% parameter(2) is the intercept
f_x = x .* parameter(1) + parameter(2);
error = mean((f_x - y).^2);