This repository has been archived on 2021-05-17. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
scientificComputing/regression/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);