7-5 多?式擬??

uX]Curve Fitting^ObƤRW`ΪkA򥻷DOH@ѼƤƪuӹG@յwICYѼƤƪuO@ӦhAhئuXS٬hX]Polynomial Fitting^CMATLAB ѤF polyfit OHihXAϥΫD`eC

ҦpGHUHfb 1790 1990]10 ~@^ơG

Example 1: 07-hBzPR/plotCensus.mload census.mat plot(cdate, pop, 'o'); xlabel('~'); ylabel('Hf]GʸU^');

Ywb褸 2002 ~`HfAi polyfit ӧX@hHGwIC]hƬ 3AhiJpUG

Example 2: 07-hBzPR/polyfit01.mwarning off % RCNiĵiT load census.mat plot(cdate, pop, 'o'); p3 = polyfit(cdate, pop, 3); cdate2 = 1790:2002; pop2 = polyval(p3, cdate2); plot(cdate, pop, 'o', cdate2, pop2, '-'); xlabel('~'); ylabel('Hf]GʸU^'); legend('ڤHf', 'wHf'); popAt2002 = polyval(p3, 2002)popAt2002 = 282.5332

Ѧuwib 2002 ~Hf 282.5 ʸUHC

ѤPƨӶihXAbu~v]Extrapolation^ɡAo쪺t۷jCڭ̥iN䵲GebP@iϤWAHKiCpUG

Example 3: 07-hBzPR/polyfit02.mwarning off % RCNiĵiT load census.mat cdate2 = min(cdate):(max(cdate)+30); curve = zeros(7, length(cdate2)); for i = 1:7 curve(i,:) = polyval(polyfit(cdate,pop,i), cdate2); end plot(cdate, pop,'o', cdate2, curve); legend('ڸ', 'order=1', 'order=2','order=3', 'order=4', 'order=5', 'order=6', 'order=7'); xlabel('~'); ylabel('Hf]GʸU^');

Ъ`NAhƶVAVGҵwơCHWz 21 IƬҡAYڭ̥ 20 hӹGAhh|qLC@ӸIC]H^oäܹwǽT׷|ChT]Noise^ӷP׸A]eͤǽT~wC]Ṷ̄Yb MATLAB զdҡAҵeXϬOm⪺AeݥXCutC^

PɡAbWzdҤA`|X{ MATLAB ĵiT]бNWzdҤ warning off RAYiݨĵiT^AoOܥѩڸƪΥѩƼƭȽd򪺹LjιLpAybihXɡAi|aӼƭȤW~tC]bihXɡAڭ̳̦nNƶi楲nBjYpdATХѡuhelp polyfitvYiouW䴩C

Hint
bMATLAB ܽd{ census.m AwWzHfƪUئuXkAzYAJushowdemo census.mvոլݡI

䥦PuXkAаѨѡuuXPjkRv`C


MATLAB{]pGig