Skip to content

Commit

Permalink
2
Browse files Browse the repository at this point in the history
  • Loading branch information
Leahy committed Dec 14, 2017
1 parent a649e13 commit 4617aa1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 37 deletions.
37 changes: 0 additions & 37 deletions bisect.m

This file was deleted.

File renamed without changes.
11 changes: 11 additions & 0 deletions least_squares.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
function [a,fx,r2] = least_squares(Z,y);
%function that accepts a z-matrix and dependent variable and returns the vector of best-fit constants, a best-fit function, and the coefficient of determination, r2
a = Z\y;
fx = Z*a;
e = y-fx;
st = std(y);
sr = std(e);
r2 = (st-sr)/st;

end

0 comments on commit 4617aa1

Please sign in to comment.