P14_3 - r a = N\r a X = (1:.01:13)'; X F = a(1,1) +...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function P14_3 f x = [3 4 5 7 8 9 11 12]; x y = [1.6 3.6 4.4 3.4 2.2 2.8 3.8 4.6]; y N = [8 sum(x) sum(x.^2) sum(x.^3); sum(x) sum(x.^2) sum(x.^3) sum(x.^4); sum(x.^2) sum(x.^3) sum(x.^4) sum(x.^5); sum(x.^3) sum(x.^4) sum(x.^5) sum(x.^6)]; r = [sum(y) sum(x.*y) sum(x.^2.*y) sum(x.^3.*y)]';
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: r a = N\r a X = (1:.01:13)'; X F = a(1,1) + a(2,1)*X + a(3,1)*X.^2 + a(4,1)*X.^3; F plot(X, F) p ybar = mean(y) y St = sum((y-ybar).^2) S St = sum((y- (a(1,1) + a(2,1)*x + a(3,1)*x.^2 + a(4,1)*x.^3)).^2) S r2 = (St-Sr)/St...
View Full Document

Ask a homework question - tutors are online