《数学Matlab实验.pdf》由会员分享,可在线阅读,更多相关《数学Matlab实验.pdf(16页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、一、实验项目一、实验项目:Matlab 基本实验二、实验目的和要求二、实验目的和要求a.熟悉 MATLAB软件的用户环境, 掌握其一般目的命令和 MATLAB数组操作与运算函数;b. 掌握 MATLAB 软件的绘图命令,能够熟练应用循环和选择结构实现各种循环选择功能;c.借助 MATLAB 软件的绘图功能,对函数的特性进行探讨,广泛联想,大胆猜想,发现进而证实其中的规律。三、实验内容三、实验内容将方程将方程x x5+55+5x x3-23-2x x+1=0+1=0 改写成各种等价的形式进行迭代,观察迭代是否收敛,并给出解释。改写成各种等价的形式进行迭代,观察迭代是否收敛,并给出解释。x1=-2
2、:0.01:2;x2=-3:0.01:3;x3=-4:0.01:4;x4=-5:0.01:5;y1=x1.5 +5*x1.3-2*x1+1;y2=x2.5 +5*x2.3-2*x2+1;y3=x3.5 +5*x3.3-2*x3+1;y4=x4.5 +5*x4.3-2*x4+1;subplot(2,2,1),plot(x1,y1),title(子图 (1) ,grid on,subplot(2,2,2),plot(x2,y2),title(子图(2),grid on,subplot(2,2,3),plot(x3,y3),title(子图(3),grid on,subplot(2,2,4),plo
3、t(x4,y4),title(子图(4) ,grid on,第 1 页 / 共 16 页子 图 (1)100500-50-100-2-10子 图 (3)200010000-1000-2000-4-2024400020000-2000-4000-5124002000-200-400-4-2子 图 (2)0子 图 (4)2405由图可知 x 的初值应在(-0.78,0.76)之间。(2)解:第一步构造迭代函数x f (x)x x 5x 12155xx 2x3353x f1(x)115x2x x 25xx f2(x)x2x f3(x)第二步利用加速迭代收敛法变形后:x 4x 10 x 12 5x15
4、 x624253x f1(x)x 2x 4x 3x5x 3x 2x 22x 8x53235x f2(x)x x 5x 6x 1x f3(x)第三步迭代设定初值第 2 页 / 共 16 页x0 0.75xn1 f (xn)n=0,1,2,3用 MATLAB 编程x=-077;y=-0.77;z=-0.77;for k=1:30 x=(-4*x5-10*x3+1)/(2-5*x4-15*x2);y=(2*y6+4*y2-3*y)/(5*y3+3*y5+2*y-2);z=(8*z2-2*z)/(z5+5*z3+6*z-1);x,y,z;end迭代结果为:x =-61.5948y =-0.7685x
5、=-49.2694y =-0.7685x =-39.4074y =-0.7685x =-31.5158第 3 页 / 共 16 页y =-0.7685x =-25.2000y =-0.7685x =-20.1442y =-0.7685x =-16.0957y =-0.7685x =-12.8521y =-0.7685第 4 页 / 共 16 页x =-10.2512y =-0.7685x =-8.1634y =-0.7685x =-6.4844y =-0.7685x =-5.1311y =-0.7685x =-4.0373第 5 页 / 共 16 页y =-0.7685x =-3.1508y
6、=-0.7685x =-2.4323y =-0.7685x =-1.8546y =-0.7685x =-1.4028y =-0.7685x =第 6 页 / 共 16 页-1.0737y =-0.7685x =-0.8700y =-0.7685x =-0.7840y =-0.7685x =-0.7689y =-0.7685x =-0.7685y =第 7 页 / 共 16 页-0.7685x =-0.7685y =-0.7685x =-0.7685y =-0.7685x =-0.7685y =-0.7685x =-0.7685y =-0.7685x =-0.7685第 8 页 / 共 16 页
7、y =-0.7685x =-0.7685y =-0.7685x =-0.7685y =-0.7685x =-0.7685y =-0.7685x =-61.5948y =-0.7685第 9 页 / 共 16 页x =-49.2694y =-0.7685x =-39.4074y =-0.7685x =-31.5158y =-0.7685x =-25.2000y =-0.7685x =-20.1442第 10 页 / 共 16 页y =-0.7685x =-16.0957y =-0.7685x =-12.8521y =-0.7685x =-10.2512y =-0.7685x =-8.1634y
8、=-0.7685x =第 11 页 / 共 16 页-6.4844y =-0.7685x =-5.1311y =-0.7685x =-4.0373y =-0.7685x =-3.1508y =-0.7685x =-2.4323y =第 12 页 / 共 16 页-0.7685x =-1.8546y =-0.7685x =-1.4028y =-0.7685x =-1.0737y =-0.7685x =-0.8700y =-0.7685x =-0.7840第 13 页 / 共 16 页y =-0.7685x =-0.7689y =-0.7685x =-0.7685y =-0.7685x =-0.7685y =-0.7685x =-0.7685y =-0.7685第 14 页 / 共 16 页x =-0.7685y =-0.7685x =-0.7685y =-0.7685x =-0.7685y =-0.7685x =-0.7685y =-0.7685x =-0.7685第 15 页 / 共 16 页y =-0.7685x =-0.7685y =-0.7685第 16 页 / 共 16 页