资源描述:
《2011秋 实验报告(5)插值实验(Interpolation)》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、年级、专业姓名学号名单序号实验时间2011年11月17日Matlab版本2010注:实验报告的最后一部分是实验小结与收获实验报告(5):插值实验(Interpolation)1.(1)WriteaMATLABfunctiontoperformtheLagrangianformInterpolation.(2)Writeacallbackm-filetocheckthefunctionyouwrite.解:%函数文件的名字存为LagIn,主要利用了数值逼近中拉格朗日基函数的表达式functionf=LagI
2、n(t,y)n=length(t);symsxw=1;forj=1:nw=w*(x-t(j));endf=0;fori=1:nl(i)=w/subs(diff(w,x,1),x,t(i))/(x-t(i));f=f+sum(l.*y);endf1=simplify(f);data=input('ÇëÊäÈëÒªÔ¤²âµÄµãµÄºá×ø±ê:');f=subs(f1,x,data)2.Inthefollowingtable(savedinthedatafilenamedInterpolation_Pro
3、blem1_data.xls),XistheFahrenheit(华氏的)temperature,andYisthenumberoftimesacricket(蟋蟀)chirps(鸣叫)inoneminute.(1)Makeascatterplot(散点图)ofthedata.(2)Interpolatethedatawithsomeloworderpiecewiseinterpolatingpolynomials.(3)Fitthedatabyusingan18th-degreepolynomialth
4、atpassingthrough(通过)thedatapointsasanempiricalmodel.Analyzetheappropriatenessofdoingso.ObservationNumberxyObservationNumberxy1464011619624950126288351551363994526314641105547215661136567016671207577717681278587318711379599019721321060932071137解:(1)x=[4649
5、515254565758596061626364666768717271];2011秋数学实验基础实验报告(5)Page4of4年级、专业姓名学号名单序号实验时间2011年11月17日Matlab版本2010注:实验报告的最后一部分是实验小结与收获实验报告(5):插值实验(Interpolation)y=[40505563727077739093968899110113120127137132137];plot(x,y,'o')title('É¢µãͼ');xlabel('xÖá');ylabel('y
6、Öá');legend('Datapoint');(2)x=[46495152545657585960616263646667687172];y=[40505563727077739093968899110113120127137132];xi=47:0.25:70;yi=interp1(x,y,xi,'spline');plot(x,y,'o',xi,yi)2011秋数学实验基础实验报告(5)Page4of4年级、专业姓名学号名单序号实验时间2011年11月17日Matlab版本2010注:实验报告的最
7、后一部分是实验小结与收获实验报告(5):插值实验(Interpolation)(3)t=[46495152545657585960616263646667687172];y=[40505563727077739093968899110113120127137132];p=polyfit(t,y,18);xi=46:0.1:72;y1=polyval(p,xi);plot(t,y,'o',xi,y1)2011秋数学实验基础实验报告(5)Page4of4年级、专业姓名学号名单序号实验时间2011年11月17日
8、Matlab版本2010注:实验报告的最后一部分是实验小结与收获实验报告(5):插值实验(Interpolation)3.(Optional)(1)WriteaMATLABfunctiontoperformtheLagrangianformInterpolationinsymbolicway.(2)Writeacallbackm-filetocheckthefunctionyouwrite.2011秋数学实验基础实验报告(5)