load population.dat x=population; N=length(x) xn = x(1:N-1); xnp1 = x(2:N); figure(1) plot(xn,xnp1,'*') del = xnp1-xn; figure(2) plot(xn,del,'*') delbyx = del./xn; figure(3) plot(xn,delbyx,'*') A = sum(xn.^2); B = sum(xn); K = N-1; MA = [A,B;B,K] R = [sum(xn.*delbyx);sum(delbyx)] ans = MA\R y = ans(1)*xn+ans(2); figure(4) plot(xn,delbyx,'*',xn,y,'--') figure(5) plot(xn,xnp1,'*',xn,xn+xn.*y) X = [0:10:700]; Y = X.*(ans(1)*X+ans(2)); figure(5) plot(xn,xnp1,'*',X, X+Y) figure(4) plot(xn,delbyx,'*',X,(ans(1)*X+ans(2)),'--')