clc;clear all; close all; x = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; y = [0 20 60 68 77 110 55 88 44 90 77]; coef = polyfit(x,y,10); x1=0:0.1:10 m=coef(2); % b=coef(3); % cf=coef(1); % ybest=cf*x1.^2+m*x1+b; ybest = polyval(coef,x1); %sum_sq = sum((y-ybest).^2); plot(x1,ybest,'-o',x,y,'o'),... xlabel('Time, s'), ylabel('Temperature, Degrees F'),... title('Linear Regression'),... grid %axis([-1,6,-20, 120])