Here is my gradientDescent function
function [theta, J_history] = gradientDescent(X, y, theta, alpha, num_iters)
m = length(y);
J_history = zeros(num_iters, 1);
for iter = 1 : num_iters
prediction = X * theta;
error = (prediction - y);
theta = theta - ((alpha/m) * ((error)'*X)');
J_history (iter) = computeCost(X, y, theta);
end
end