P13_5b - x y = [5 6 7 6 9 8 7 10 12 12]'; y n = 10; n xbar2...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
function P13_5b f x = [0 2 4 6 9 11 12 15 17 19]'; x y = [5 6 7 6 9 8 7 10 12 12]'; y n = 10; n xbar = sum(x)/n; x ybar = sum(y)/n; y a1 = ((n*sum(x.*y) - sum(x)*sum(y))/(n*sum(x.^2) - (sum(x))^2)) a a0 = ybar - a1*xbar a X = (0:0.1:20)'; X F = a0 + a1*X; F Sr = sum((y - (a0 + a1.*x)).^2) S St = sum((y - ybar).^2) S Serr = sqrt(Sr/(n-2)) S r = sqrt((St-Sr)/St) r %-------------------------------------------------------------------------- % x = [0 2 4 6 9 11 12 15 17 19]';
Background image of page 1

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

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: x y = [5 6 7 6 9 8 7 10 12 12]'; y n = 10; n xbar2 = sum(x)/n; x ybar2 = sum(y)/n; y a1 = ((n*sum(y.*x) - sum(x)*sum(y))/(n*sum(y.^2) - (sum(y))^2)) a a0 = xbar2 - a1*ybar2 a F2 = (X - a0)/a1; F Sr = sum((x - (a0 + a1.*y)).^2) S St = sum((x - xbar2).^2) S Serr = sqrt(Sr/(n-2)) S r = sqrt((St-Sr)/St) r plot(X,F, 'k') hold on plot(X, F2, 'r--') plot(x,y, ' p...
View Full Document

This note was uploaded on 09/21/2011 for the course EGM 3344 taught by Professor Raphaelhaftka during the Spring '09 term at University of Florida.

Page1 / 2

P13_5b - x y = [5 6 7 6 9 8 7 10 12 12]'; y n = 10; n xbar2...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online