- 1、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
数学实验实验报二答案
实 验 二
实验项目名称:插值与拟合
实验内容:
建立拉格朗日插值的函数M文件lagr.m。
New script 源程序:
function y lagr x0,y0,x
n length x0 ;m length x ;
for i 1:m z x i ; s 0; for k 1:n p 1; for j 1:n if j~ k p p* z-x0 j / x0 k -x0 j ; end end s p*y0 k +s; end y i s;
end
保存为larg.m
完成机床加工问题中数据增加密度,利用三种插值方法计算加工所需数据,并画出曲线,比较分析三种插值结果。(参考教材P77)
源程序:
x0 [0,3,5,7,9,11,12,13,14,15];y0 [0,1.2,1.7,2.0,2.1,2.0,1.8,1.2,1.0,1.6];x 0:0.1:15;y1 lagr x0,y0,x ;y2 interp1 x0,y0,x ;y3 interp1 x0,y0,x,spline ;[x,y1,y2,y3];subplot 3,1,1 plot x0,y0,k+,x,y1,r grid,title lagrange subplot 3,1,2 plot x0,y0,k+,x,y2,r grid,title piecewise?linear subplot 3,1,3 plot x0,y0,k+,x,y3,r grid,title spline
实验结果:
完成教材P80习题1中的函数y sinx的三种插值结果的分析和比较。
源程序:
n 10;m 100;
x linspace 0,2*pi,100 ;
y sin x ;
z x*0;
x0 linspace 0,2*pi,6 ;
y0 sin x0 ;
y1 lagr x0,y0,x ;
y2 interp1 x0,y0,x ;
y3 interp1 x0,y0,x,spline ;
plot x,z,x,y,k,x,y1,x,y2,x,y3,y
实验结果:
完成教材P81习题2。
源程序:
x0 [0,1,4,9,16];
y0 sqrt x0 ;
x 5;
y sqrt 5
y1 lagr x0,y0,x
x0 1 [];
y0 sqrt x0 ;
y2 lagr x0,y0,x
x0 4 [];
y0 sqrt x0 ;
y3 lagr x0,y0,x
x0 1 [];
y0 sqrt x0 ;
y4 lagr x0,y0,x 实验结果:
y 2.2361
y1 2.0794
y2 2.2540
y3 2.2667
y4 2.2000
理解教材的拟合应用实例-给药方案,参考该实例完成教材P81习题6。
源程序:(τ输入成t0)
t [0.5, 1, 2, 3, 4, 5, 7, 9];
v [6.36, 6.48, 7.26, 8.22, 8.66, 8.99, 9.43, 9.63];
y log 10 - v ;
a polyfit t,y,1 ;
t0 -1/a 1
vo 10-exp a 2
实验结果:
t0 3.5269
vo 5.6221
即初始电压为5.6221,充电常数位3.5269
situation, causing the livelihood of 100 tailings project management project and South Mining Technology in two engineering work lag. Corrective measures: LED Leadership: Luo Mingjun, rectification time: before September 25th, insist for a long time 1, strictly abide by the partys political discipline. Strictly abide by the constitution, the principle of Party organization and party political life standards, do not spread against the partys theory and policy advice, not contrary to published The central and provincial Party committee decided to talk, not to divulge the secrets of the
文档评论(0)