欢迎来到天天文库
浏览记录
ID:14101890
大小:353.00 KB
页数:8页
时间:2018-07-26
《数值分析的matlab程序设计》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、数值分析作业题目利用MATLAB编写数值算法程序班级/学号04140101/20100414028学生姓名张阳指导教师刘勇进一、编写lagrange插值法计算拉氏基函数,再求和。图1拉氏基函数求解流程图Lagrange_base_function.m文件%Copyright(c)2012ShenYangAreospaceUniversity%Allrightsreserved%%filename:Lagrange_base_function.m%summary:%%currentedition:%programmer:YungZhung%accomplishtime:2012
2、-04-15%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%functionname:Lagrange_base_function.m%functiondescribe:%functionindetailed:%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%functionY=Lagrange_base_function(x,k)n=length(x);y=ones(n,2);Y=1;forii=1:ni
3、fii==kcontinue;endy(ii,2)=-x(ii);Y=conv(Y,y(ii,:));endend图2计算lagrange插值函数及差值值Lagrange.m文件%Copyright(c)2012ShenYangAreospaceUniversity%Allrightsreserved%%filename:Lagrange.m%summary:%%currentedition:%programmer:YungZhung%accomplishtime:2012-04-15%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
4、%%%%%%%%%%%%%%%%%%%%%%functionname:Lagrange.m%functiondescribe:%functionindetailed:%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%functionY=Lagrange(x,y,point)ifmin(size(x))>1
5、
6、min(size(y))>1error('themuxtbetwovectors!!!');endn=length(x);ifn~=length(y)error('thedimention
7、ofthetwovectorsmustaggree!!!');endY=0;forii=1:ny_1=Lagrange_base_function(x,ii);Y=polyadd(Y,y(ii)*y_1/polyval(y_1,x(ii)));endifnargin==2disp(Y);elseY=polyval(Y,point);end一、编写复合二重simpson求积公式图3二重复合simpson公式流程图转化为一重simpson求积公式。%Copyright(c)2012ShenYangAreospaceUniversity%Allrightsreserved%%fil
8、ename:simpson_con.m%summary:%%currentedition:%programmer:YungZhung%accomplishtime:2012-06-25%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%functionname:simpson_con.m%functiondescribe:%functionindetailed:%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
9、function[val]=simpson_con(f,a,b,c,d,m,n)ifb
此文档下载收益归作者所有