# P13_5 - -y = [0 2 4 6 9 11 12 15 17 19]'; y x = [5 6 7 6 9...

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

function P13_5 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 sumx = sum(x); s sumy = sum(y); s n = 10; n sumxy = 0; s sumx2 = 0; s xbar = sumx/n; x ybar = sumy/n; y for i = (1:10) sumxy = sumxy + x(i,1)*y(i,1); end e for i = (1:10) sumx2 = sumx2 + x(i,1)*x(i,1); end e a1 = (n*sumxy - sumx*sumy)/(n*sumx2 - sumx^2); a a0 = ybar - a1*xbar; a X = (1:1:20)'; F = a0 + a1.*X; F %----------------------------------------------------------------------------------

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: -y = [0 2 4 6 9 11 12 15 17 19]'; y x = [5 6 7 6 9 8 7 10 12 12]'; x sumx = sum(x); s sumy = sum(y); s n = 10; n sumxy = 0; s sumx2 = 0; s xbar = sumx/n; x ybar = sumy/n; y for i = (1:10) sumxy = sumxy + x(i,1)*y(i,1); end e for i = (1:10) sumx2 = sumx2 + x(i,1)*x(i,1); end e a1 = (n*sumxy - sumx*sumy)/(n*sumx2 - sumx^2); a a0 = ybar - a1*xbar; a X = (1:1:20)'; F = a0 + a1.*X; F plot (X, F)...
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_5 - -y = [0 2 4 6 9 11 12 15 17 19]'; y x = [5 6 7 6 9...

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

View Full Document
Ask a homework question - tutors are online