|
|
|
@ -10,15 +10,13 @@ function [X_poly] = polyFeatures(X, p)
|
|
|
|
|
X_poly = zeros(numel(X), p);
|
|
|
|
|
|
|
|
|
|
% ====================== YOUR CODE HERE ======================
|
|
|
|
|
% Instructions: Given a vector X, return a matrix X_poly where the p-th
|
|
|
|
|
% Instructions: Given a vector X, return a matrix X_poly where the p-th
|
|
|
|
|
% column of X contains the values of X to the p-th power.
|
|
|
|
|
%
|
|
|
|
|
%
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
%
|
|
|
|
|
for i = 1 : p
|
|
|
|
|
X_poly(:,i) = X .^ i;
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
% =========================================================================
|
|
|
|
|
|
|
|
|
|