function [m,q] = regline(x,y) A = corrcoef(x,y); m = std(y)/std(x)*A(1,2); q = mean(y)-m*mean(x); plot(x,y,'x') hold on yy = m*x + q; plot(x,yy)