Fenghe's Blog

Regression in MATLAB

NOTE: The Machine Learning ToolKit is required for MATLAB to perform regression.

% X and Y are row vectors
[R, M, B] = regression(X, Y);

% when X and Y are column vectors
[R, M, B] = regression(X', Y');

R is the MSE(Mean Square Root Error) of the data, M is the slope of the regression line, B is the y-intercept.

Leave a Reply

Your email address will not be published. Required fields are marked *