clc;clear
format short e
wp = 0:10:100; % wt% methanol
Den = [998.2,981.5,966.6,951.5,934.5,915.6,894.6 ...
      ,871.5,846.9,820.2,791.7];
coeff = polyfit(wp,Den,6)
wpP = linspace(0,100);
DenP = polyval(coeff,wpP);
plot(wp,Den,'sk',wpP,DenP,'k-')
grid
xlabel('Temperature - degC')
ylabel('Density - kg/m3')
DenP1 = polyval(coeff,wp);
resid = Den - DenP1;
figure % new figure
plot(DenP1,resid,'sk-')
grid
xlabel('Predicted Density - kg/m3')
ylabel('Residual Value - kg/m3')
title('Residuals vs. Fits Plot')

