Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
8 lines (7 sloc) 151 Bytes
function [a,fx,r2] = least_squares(Z,y)
a = Z\y;
Sr = sum((y-Z*a).^2);
r2 = 1-Sr/sum((y-mean(y)).^2);
x = Z(:,2);
fx = a(1)+(a(2)*x)+(a(3)*x.^2);
end
You can’t perform that action at this time.