教学文库网 - 权威文档分享云平台
您的当前位置:首页 > 文库大全 > 专业资料 >

大学数值计算方法题目答案

来源:网络收集 时间:2026-05-19
导读: 数值计算方法 黄云清编 数值计算方法 Project II solutions: 1.Give the formula of the following methods: Langerange Interpolation、Piecewise Linear Langerange Interpolation and Cubic Spline Interpolation (1)Langerange Interpolation formula:

数值计算方法 黄云清编

数值计算方法

Project II solutions:

1.Give the formula of the following methods: Langerange Interpolation、Piecewise Linear Langerange Interpolation and Cubic Spline Interpolation

(1)Langerange Interpolation formula:

Ln(x) yili(x),

i 0n

li(x) (x x0)...(x xi 1)(x xi)...(x xn),i 0,1,...,n(xi x0)...(xi xi 1)(xi xi 1)...(xi xn)

其中基函数满足:

1,i j li(xj) 0,i j,i,j 0,1,...n

Piecewise Linear Langerange Interpolation formula: In yjlj(x),

j 0n

x xj 1,xj 1 x xj x xj 1 j x xj 1lj(x) ,xj x xj 1 xj x 0,x

Cubic Spline Interpolation:

S(x) Si(x),x xi 1,xi ,i 1,...,n

Si(x) aix bix cix di32

其中ai,bi,ci,di为待定系数,共4n个,且满足条件:

数值计算方法 黄云清编

Si(xi) Si 1(xi) ① Si'(xi) Si' 1(xi),i 1,2,...,n 1,

'''' Si(xi) Si 1(xi)

② S''(x0) S''(xn) 0

(2) Give MatLab or C program

langerange函数文件:

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

程序:

x0=[2006.01,2006.02,2006.03,2006.04,2006.05,2006.06,2006.07,2006.08,2006.09,2006.10,2006.11,2006.12,2007.01,2007.02,2007.03,2007.04,2007.05,2007.06,2007.07,2007.08,2007.09,2007.10,2007.11,2007.12,2008.01,2008.02,2008.03,2008.04,2008.05,2008.06,2008.07,2008.08,2008.09,2008.10,2008.11,2008.12,2009.01,2009.02,2009.03,2009.04,2009.05,2009.06];

y0=[8.0668 8.0493 8.0035 8.0156 8.0152 8.0067

7.991 7.9733 7.9368 7.9032 7.8652 7.8238 7.7898

7.7546 7.739 7.7247 7.6704 7.633 7.5805 7.5753

7.5258 7.5805 7.4233 7.3676 7.2478 7.1601 7.0752 7.2478 6.9724 6.8971 6.8376 6.8515

6.8307 6.8316 6.8286 6.8424 6.8382 6.8357

6.8341 6.8312 6.8345 6.8332];

x=2005:0.1:2010;

y1=lagr(x0,y0,x);

y2=interp1(x0,y0,x);

y3=spline(x0,y0,x);

z=0*x;

数值计算方法 黄云清编

plot(x,z,x0,y0,'.',x,y1,'r',x,y2,'m',x,y3,'c') axis([2005 2010 -10 10])

gtext('lagr')

gtext('interp1')

gtext('spline')

(3)Plot the figures of the above methods.

大学数值计算方法题目答案.doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印
本文链接:https://www.jiaowen.net/wenku/269815.html(转载请注明文章来源)
Copyright © 2020-2025 教文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ:78024566 邮箱:78024566@qq.com
苏ICP备19068818号-2
Top
× 游客快捷下载通道(下载后可以自由复制和排版)
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能出现无法下载或内容有问题,请联系客服协助您处理。
× 常见问题(客服时间:周一到周五 9:30-18:00)