MATLAB: Can I use “LinearModel.fit(X,y) with matlab 2011a linear regression I am using matlab 2.12a and I am trying to use mdl=LinearModel.fit(X,y)but am getting an error message Best Answer LinearModel.fit was released as part of the R2012a release so you cannot use that with R2011a. Related SolutionsMATLAB: How to create a model using the mdl=LinearModel.fit(X,y) http://www.mathworks.com/matlabcentral/newsreader/view_thread/323406Points to the exact release notes that confirm that this was new in R2012a MATLAB: Linear fit lsline is in the Statistics Toolbox, if you do not have that product you can use polyfit() to fit a 1st order polynomial. x = 1:10; y1 = x + randn(1,10); scatter(x,y1,25,'b','*') P = polyfit(x,y1,1); yfit = P(1)*x+P(2); hold on; plot(x,yfit,'r-.'); Related QuestionWhy I can’t run LinearModel.fit on the Matlab R2011bDo I need to add a column of ones on the predictor matrix for use in LinearModel.fit(X,y)Is LinearModel.fit available in Matlab 2010a
Best Answer