资源描述:
《14Curve_Fitting_&_Interpolation》由会员上传分享,免费在线阅读,更多相关内容在学术论文-天天文库。
1、APPLICATIONSOFMATLABINENGINEERINGYan-FuKuoFall2015Dept.ofBio-industrialMechatronicsEngineeringNationalTaiwanUniversityToday:•Polynomialcurvefitting•Multipleregression•InterpolationApplicationsofMATLABinEngineeringY.-F.Kuo2SimpleLinearRegression•Abunchofdatapoints(??,??)ar
2、ecollected•Assume?and?arelinearlycorrelated?(??,??)??=?0+?1????(??,??)?ApplicationsofMATLABinEngineeringY.-F.Kuo3LinearRegressionFormulation•Definesumofsquarederrors(???):???=?2=(?−?)2?????•Giventhattheregressionmodel:??=?0+?1??,???=(?−?−??)2?01??•Whatvariablesareknownand
3、whatareunknown?•Howdoweobtaintheoptimalparameters?ApplicationsofMATLABinEngineeringY.-F.Kuo4SolvingLeast-squaresProblem•???isminimizedwhenitsgradientwithrespecttoeachparameterisequaltozero:??2??=−2??−?0−?1??=0??0???2??=−2??−?0−?1????=0??1?ApplicationsofMATLABinEngineering
4、Y.-F.Kuo5Least-squaresSolution•Supposethereexists?datapoints:????=?0∙?+?1???=1?=1?????=??+??2??0?1??=1?=1?=1??????0⇒=?1????2????ApplicationsofMATLABinEngineeringY.-F.Kuo6PolynomialCurveFitting:polyfit()15•Curvefittingfordatapoints10best-fitpolynomialsof5differentorders0-5
5、-10-15-20-2-101234x=[-1.2-0.50.30.91.82.63.03.5];y=[-15.6-8.52.24.56.68.28.910.0];fit=polyfit(x,y,1);xfit=[x(1):0.1:x(end)];yfit=fit(1)*xfit+fit(2);plot(x,y,'ro',xfit,yfit);set(gca,'FontSize',14);legend(2,'datapoints','best-fit');ApplicationsofMATLABinEngineeringY.-F.Kuo7
6、Exercise•Giventhetablebelow:1.Findthe?0and?1oftheregressionline2.PlotthefigureCalibrationofTC0.08TCOutputTemperature0.07(mV)(oC)0.060.025200.035300.050.05040TCoutput(mV)0.040.060500.030.080600.022030405060oTemperature(C)ApplicationsofMATLABinEngineeringY.-F.Kuo8Are?and?Li
7、nearlyCorrelated?•Ifnot,thelinemaynotwell10describetheirrelationship5•Checkthelinearitybyusing0-5•scatter():scatterplot-10•corrcoef():correlation-15coefficient,−1≤?≤1-20-2-101234x=[-1.2-0.50.30.91.82.63.03.5];y=[-15.6-8.52.24.56.68.28.910.0];scatter(x,y);boxon;axissquare;
8、corrcoef(x,y)ApplicationsofMATLABinEngineeringY.-F.Kuo9HigherOrderPolynomialsx=[-1.2-0.50.30.91.