Skip to content
Permalink
048fa8e03f
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
24 lines (6 sloc) 148 Bytes
function [a, fx, r2] = least_squares(Z,y)
a=(Z'*Z)\(Z'*y);
Sr = sum((y-Z*a).^2);
r2 = 1-Sr/sum((y-mean(y)).^2);
fx=Z*a;
end