1function [X_poly] = polyFeatures(X, p) 2%POLYFEATURES Maps X (1D vector) into the p-th power 3% [X_poly] = POLYFEATURES(X, p) takes a data matrix X (size m x 1) and 4% maps each example into its polynomial features where 5% X_poly(i, :) = [X(i) X(i).^2 X(i).^3 ... X(i).^p]; 6% 7 8 9% You need to return the following variables correctly. 10X_poly = zeros(numel(X), p); 11 12% ====================== YOUR CODE HERE ====================== 13% Instructions: Given a vector X, return a matrix X_poly where the p-th 14% column of X contains the values of X to the p-th power. 15% 16% 17fprintf("Before feature-mapping\n"); 18disp(X_poly); 19for i = 1:p 20 X_poly(:,i) = X.^i; 21end 22fprintf("After feature-mapping\n"); 23disp(X_poly); 24% ========================================================================= 25 26end 27 28