Y = kx + b; in the form of a linear fit (least squares based)
method one:
x = data1; y = data2;% datat1 and data2 are multiple row-column matrix
p=polyfit(x,y,1);
x1=linspace(min(x),max(x));
y1=polyval(p,x1);
plot (x, y, '*', x1, y1);% Drawing
Results: p = a b
I.e., y = a * x + b
Fitting the graphic will be displayed in the plot