% Plot Sum of squared residuals for least squares polynomial fit for % 5th order polynomial data -- L Braile, September 2002 % enter data for each order of polynomial xorder = [1 2 3 4 5 6 7 8]; % For std = 0.25 noise residual1 = [34.006 25.897 10.426 6.464 1.618 1.615 1.582 1.581]; % For std = 0.50 noise residual2 = [43.630 35.318 15.564 11.442 6.471 6.460 6.329 6.324]; % plot graph plot(xorder,residual1,'or',xorder,residual1,'-k',xorder,residual2,'+b',xorder,residual2,'-b') xlabel('Order of Polynomial') ylabel('Sum of squares of residuals') title('Residuals vs. order of polynomial; o = 0.25 std noise, + = 0.50 std noise')