I'm attaching code that illustrates how to solve the problem using either Statistics Toolbox or base MATLAB.
The Statistic Toolbox solution uses some new functionality that's shipping in 12a. The base MATLAB solution will work regardless of what version you have.
X = 1:100;
X = X';
Y = 50 + 5*X + randn(100,1);
myFit = LinearModel.fit(X, Y, 'y ~ -1 + x1')
coefficients = X\Y
Y = 50 + 5*X + 3*X.^2 + randn(100,1);
myFit2 = LinearModel.fit(X,Y, 'y ~ -1 + x1^2')
NewX = [X, X.^2];
coefficients = NewX\Y