以下例子使用1960,1970,1990和2000的人口估计1980的人口。分别用了直线估计和抛物线估计。
% page 199 3
% this problem is to estimate the populatipn in 1980 and
% compare the error using different method to estimate
% one use line and the other is parabale
% input:none
% output:plot the figure and display error
function page_199_3_script
format long;
x0 = [0 10 30 40];
y0 = [3039585530 3707475887 5281653820 6079603571];
x1 = 0:.01:450;
c1 = polyfit(x0,y0,1);