normalEqn.m 636 B

1234567891011121314151617181920212223
  1. function [theta] = normalEqn(X, y)
  2. %NORMALEQN Computes the closed-form solution to linear regression
  3. % NORMALEQN(X,y) computes the closed-form solution to linear
  4. % regression using the normal equations.
  5. theta = (X'*X)\X'*y;
  6. % ====================== YOUR CODE HERE ======================
  7. % Instructions: Complete the code to compute the closed form solution
  8. % to linear regression and put the result in theta.
  9. %
  10. % ---------------------- Sample Solution ----------------------
  11. % -------------------------------------------------------------
  12. % ============================================================
  13. end