Lear Regresso Hsao-Lug Cha Dept Electrcal Egeerg Chag Gug Uverst, Tawa chahl@mal.cgu.edu.tw
Curve fttg Least-squares regresso Data ehbt a sgfcat degree of error or scatter A curve for the tred of the data Iterpolato Data are ver precse Ft a curve passg drectl through each pot Lear terpolato Curvlear terpolato
Wd tuel epermet Measure how the force of ar resstace depeds o veloct Force versus wd veloct for a object suspeded a wd tuel 3
Basc statstcs Arthmetc mea Varace s Coeffcet of varato c.v. s 00% Meda, the mdpot of a group of data Mode, the value that occurs most frequetl / mea) var) degrees of freedom: s kow ad - of the values are specfed cv=std)/mea)*00; quatfg the spread of data meda) mod) 4
Normal dstrbuto Gaussa dstrbuto) hst) bs=0; hst,bs) bs=6.4:0.:6.8; hst,bs) [couts ceter]=hst ); 5
Radom umber Geerates a sequece of umbers that are uforml dstrbuted betwee 0 ad r = radm, ); % m-b- matr of radom umbers Geerate a uform dstrbuto o aother terval ruform = low + up low) * radm, ); % low = the lower boud, up = the upper boud Geerate a ormal dstrbuto wth a dfferet mea m) ad stadard devato s) rormal = m + s * radm, ); 6
Geeratg uform radom values of drag freefallg bugee jumper If the tal veloct s zero, the dowward veloct s t=4; m=68.; g=9.8; % parameters cd=0.5; % drag coeffcets cdm=cd-0.05; cdma=cd+0.05; r=rad000,); cdrad=cdm+cdma-cdm)*r; subplot,,) hstcdrad), ttle'a) Dstrbuto of drag'), label'cd kg/m)') vrad=sqrtg*m./cdrad).*tahsqrtg*cdrad/m)*t); subplot,,) hstvrad), ttle'b) Dstrbuto of veloct'), label'v m/s)') 7
Lear least-squares regresso f ) a 0 a 0 a a Best for least-squares regresso meas mmzg the sum of the squares of the estmate resduals. S a S a r r S r e 0 0 a 0 a a a 0 a 8
M-fle of curve fttg b lear regresso fucto [a, r] = lregr,) % = depedet varable, = depedet varable % output: a) = slope, a)=tercept % r = coeffcet of determato = legth); = :); = :); % covert to colum vectors s = sum); s = sum); s = sum.*); s = sum.*); s = sum.*); a) = *s s*s)/*s s^); a) = s/ a)*s/; r = *s s*s)/sqrt*s s^)/sqrt*s s^))^; % create plot of data ad best ft le p = lspacem),ma),); p = a)*p+a); plot,,'o',p,p) grd o 9
Quatfcato of error of lear regresso Lear regresso wth small ad large resdual errors How to quatf the goodess of regresso ft? 0
Quatfcato of error of lear regresso cot.) Sum of the squares of the resduals betwee data pots ad regresso le Sum of the squares of the resduals betwee data pots ad mea
Quatfcato of error of lear regresso cot.) Spread of the data aroud the mea Spread of the data aroud the best-ft le
Quatfcato of error of lear regresso cot.) Coeffcet of determato Alteratve defto of correlato coeffcet 3 ) ) ) ) / ) / ) ) / ) ) ) ) ) a
Quatfcato of error of lear regresso cot.) Stadard error of the estmate stadard devato for the regresso / desgates that the error s for a predcted value of correspodg to a partcular value of. Dvde b because two data-derved estmates a 0 ad a were used to compute Sr lost two degrees of freedom) 4
Learzato of olear relatoshps epoetal model power equato saturato-growthrate equato l = l α + β log = log α + β log / = /α 3 + β 3 /α 3 / 5
MATLAB bult- fucto polft Fts a least-squares th -order polomal to data p = polft,, ); Eample = [0 0 30 40 50 60 70 80]; = [5 70 380 550 60 0 830 450]; a = polft,,); polval, computg a value usg the coeffcets = polvalp, ); 6
Referece Steve C. Chapra "Appled Numercal Methods wth MATLA B", 3rd ed., McGraw Hll, 0. 7