for iter = 1:num_iters
error = X'*(X*theta - y);
theta = theta - alpha/m*error;
J_history(iter) = computeCost(X, y, theta);
end
error = X*theta - y;
J = sum(error.*error)/(2*m);
mu = mean(X);
sigma = std(X);
n = length(mu);
for i = 1:n
X_norm(:,i) = (X(:,i) - mu(i))/sigma(i);
end
for iter = 1:num_iters
error = X'*(X*theta - y);
theta = theta - alpha/m*error;
% Save the cost J in every iteration
J_history(iter) = computeCostMulti(X, y, theta);
end
theta = pinv(X'*X)*X'*y;