clear
clc
close all
x=[0 1 2 3 4 5 6 7];
y=[0 3 5 7 9 11 15 19];
coeffit=polyfit(x,y,1);
slope=coeffit(1);
intercept=coeffit(2);
figure(1)
scatter(x,y,'filled')
hold on
x_fit = min(x):0.1:max(x);
% y_fit = slope * x_fit + intercept;
y_fit=polyval(coeffit,x_fit)
plot(x_fit, y_fit, 'r');
hold off
grid on