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/regression/code/lsq_sigmoid_error.m

8 lines
242 B
Matlab

function error = lsq_sigmoid_error(parameter, x, y)
% p(1) the amplitude
% p(2) the slope
% p(3) the x-shift
% p(4) the y-shift
y_est = parameter(1)./(1+ exp(-parameter(2) .* (x - parameter(3)))) + parameter(4);
error = mean((y_est - y).^2);