warmUpExercise.m:
A = eye(5);plotData.m:
plot(x,y,'rx','markersize',10);
xlabel('Population of City in 10,1000s');
ylabel('Profit in $10,1000s');
J = (1/(2*m))*sum((X*theta-y).^2);
theta = theta - alpha*(1/m)*(X' * (X*theta-y))
本文介绍了使用Matlab进行编程的基本操作,包括创建单位矩阵、绘制数据图表、计算成本函数及实现梯度下降算法等内容。
warmUpExercise.m:
A = eye(5);plotData.m:
plot(x,y,'rx','markersize',10);
xlabel('Population of City in 10,1000s');
ylabel('Profit in $10,1000s');
J = (1/(2*m))*sum((X*theta-y).^2);
theta = theta - alpha*(1/m)*(X' * (X*theta-y))
被折叠的 条评论
为什么被折叠?