Lab 11

Lab 11 - LAB 11 Name: __Ryan Corley __ Sec_4 _ Example 1:...

This preview shows pages 1–4. Sign up to view the full content.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: LAB 11 Name: __Ryan Corley __ Sec_4 _ Example 1: Finding and Displaying Residuals a) Load the mensRecords.xls file using the appropriate function. Then find the best linear fit, (linearPoly = polyfit(xdata,ydata,1); m=linearPoly(1); b=linearPoly(2);) Then use the function y=m*x+b as an estimate for the line of best fit (remember x ranges over 1896 and 1988). Compare this linear fit to the true data points by obtaining the residuals and graphing them with a bar graph. m=xlsread('mensRecords.xls') m = 1.0e+003 * 1.8960 0.0542 1.9000 0.0494 1.9040 0.0492 1.9060 0.0532 1.9080 0.0500 1.9120 0.0482 1.9200 0.0500 1.9240 0.0476 1.9280 0.0478 1.9320 0.0462 1.9360 0.0465 1.9480 0.0462 1.9520 0.0459 1.9560 0.0467 1.9600 0.0449 1.9640 0.0451 1.9680 0.0439 1.9720 0.0447 1.9760 0.0443 1.9800 0.0446 1.9840 0.0443 1.9880 0.0439 linearPoly = polyfit(m(:,1),m(:,2),1) linearPoly = -0.0867 215.3594 M=linearPoly(1) M = -0.0867 b=linearPoly(2) b = 215.3594 x1=(0:.01:2000); y1=-.0867*(m(:,1))+215.3594; plot(m(:,1), m(:,2), 'rx', m(:,1), y1) xlabel('Year') ylabel('Medals') title('Line Approximating the Data') 1890 1900 1910 1920 1930 1940 1950 1960 1970 1980 1990 42 44 46 48 50 52 54 56 Year Medals Line Approximating the Data yEst=-.0867*m(:,1)+215.3594 yEst = 50.9762 50.6294 50.2826 50.1092 49.9358 49.5890 48.8954 48.5486 48.2018 47.8550 47.5082 46.4678 46.1210 45.7742 45.4274 45.0806 44.7338 44.3870 44.0402 43.6934 43.3466 42.9998 res = m(:,2) - yEst res = 3.2238-1.2294-1.0826 3.0908 0.0642-1.3890 1.1046-0.9486-0.4018-0....
View Full Document

This homework help was uploaded on 04/17/2008 for the course MAP 2480 taught by Professor Monicahurdal during the Fall '07 term at FSU.

Page1 / 9

Lab 11 - LAB 11 Name: __Ryan Corley __ Sec_4 _ Example 1:...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online