




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、MATLAB程序设计实验6解方程和最优化问题求解一 实验目的1. 掌握线性方程组的数值求解方法。2. 掌握常微分方程的数值求解方法。3. 掌握非线性方程以及最优化问题的求解方法。二 实验内容1. 对下列线性病态方程组:a) 求方程组的解。 A=1/2,1/3,1/4;1/3,1/4,1/5;1/4,1/5,1/6; b=0.95,0.67,0.52; x=Abx = 1.2000 0.6000 0.6000b) 将方程组右边的向量元素b3(0.52)修改为0.53,再次求方程组的解。比较b3的变化和解的相对变化。 A=1/2,1/3,1/4;1/3,1/4,1/5;1/4,1/5,1/6;b=
2、0.95,0.67,0.53;x=Abx = 3.0000 -6.6000 6.6000c) 求系数矩阵的条件数,并分析条件数对线性方程组求解的影响。2. 求方程的解。a)函数文件:funx.mfunction fx=funx(x)fx=x41+x3+1;调用: z=fzero(funx,-1)z = -0.9525b)函数文件funx.mfunction fx=funx(x)fx=x-sin(x)./x; z=fzero(funx,0.5)z =0.8767c),函数文件:funx.m z=fzero(funx,0.5)z =0.8767调用函数: options=optimset(Disp
3、lay,off); x=fsolve(funx,1,1,1,options)x = 0.5991 2.3959 2.00503. 求常微分方程的数值解。a) ,函数文件:function yp=funx(t,y)yp=-(1.2+sin(10*t).*y; 函数调用: t0=0; tf=5; y0=1; t,y=ode23(funx,t0,tf,y0); tans = Columns 1 through 9 0 0.0667 0.1375 0.2003 0.2695 0.3528 0.4362 0.5033 0.5663 Columns 10 through 18 0.6369 0.6913
4、0.7457 0.8081 0.8738 0.9591 1.0277 1.0963 1.1600 Columns 19 through 27 1.2246 1.3082 1.3714 1.4347 1.5001 1.5842 1.6530 1.7219 1.7858 Columns 28 through 36 1.8501 1.9319 1.9953 2.0587 2.1236 2.2053 2.2745 2.3438 2.4080 Columns 37 through 45 2.4719 2.5501 2.6140 2.6779 2.7419 2.8193 2.9046 2.9685 3.0
5、323 Columns 46 through 54 3.0959 3.1721 3.2364 3.3007 3.3642 3.4395 3.5328 3.5965 3.6602 Columns 55 through 63 3.7238 3.7998 3.8642 3.9286 3.9920 4.0671 4.1408 4.2144 4.2800 Columns 64 through 72 4.3432 4.4159 4.4812 4.5465 4.6094 4.6812 4.7567 4.8322 4.8990 Columns 73 through 74 4.9620 5.0000 yans
6、= Columns 1 through 9 1.0000 0.9035 0.7822 0.6823 0.5984 0.5402 0.5182 0.5106 0.4976 Columns 10 through 18 0.4656 0.4280 0.3844 0.3355 0.2936 0.2595 0.2469 0.2421 0.2382 Columns 19 through 27 0.2290 0.2054 0.1819 0.1585 0.1387 0.1225 0.1164 0.1140 0.1122 Columns 28 through 36 0.1080 0.0974 0.0864 0.
7、0753 0.0658 0.0581 0.0549 0.0537 0.0529 Columns 37 through 45 0.0511 0.0466 0.0415 0.0361 0.0316 0.0278 0.0258 0.0253 0.0249 Columns 46 through 54 0.0241 0.0221 0.0197 0.0172 0.0150 0.0132 0.0122 0.0119 0.0117 Columns 55 through 63 0.0114 0.0104 0.0093 0.0081 0.0071 0.0062 0.0058 0.0056 0.0055 Colum
8、ns 64 through 72 0.0054 0.0050 0.0045 0.0039 0.0034 0.0030 0.0027 0.0026 0.0026 Columns 73 through 74 0.0025 0.0025b) ,函数文件:function yp=funx(t,y)yp=-y./(1+t2)+cos(t); 函数调用: t0=0; tf=5; y0=1; t,y=ode23(funx,t0,tf,y0); tans = Columns 1 through 9 0 0.5000 0.8016 1.1033 1.4077 1.7537 2.2301 2.5215 2.812
9、9 Columns 10 through 18 2.9727 3.1326 3.3001 3.5091 3.7549 4.0375 4.3637 4.7584 5.0000 yans = Columns 1 through 9 1.0000 1.0146 1.0363 1.0450 1.0162 0.9157 0.6451 0.4122 0.1437 Columns 10 through 18 -0.0122 -0.1699 -0.3330 -0.5273 -0.7327 -0.9233 -1.0649 -1.1040 -1.05344. 求函数在指定区间的最大值。,函数文件:function
10、 fx=funx(x)fx=-(1+x2)/(1+x4);函数调用: x=fminbnd(funx,0,2)x = 0.64365. 有400万资金,要求在4年内使用完,若在一年内使用资金x万元,则可得效益万元(效益不能再次使用),当年不用的资金可以存入银行,年利率为10%。制订资金的使用方案,使4年效益之和最大。函数文件funx.m:function fx=funx(x)fx=sqrt(x(1)+sqrt(x(2)+sqrt(x(3)+sqrt(x(4);函数文件fx.m:x0=400,400,400,400;A=1,0,0,0;1.1,1,0,0;1.12,1.1,1,0;1.13,1.12,1.1,1;b=400*1,1.1,1.12,1.13;x,f=fmincon(funx,x0,A,b,) fxMaximum nu
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 【正版授权】 IEC 63453:2025 EN Railway applications - Current collection systems - Validation of simulation of the dynamic interaction between pantograph and overhead contact line
- 详尽多条款单项劳务分包合同
- 保险服务居间合同
- 工业厂房租赁合同
- 建筑工程款转让协议书
- 装卸运输服务合同
- 智能科技产品开发合作合同
- 个人果树承包合同
- 管理软件系统买卖合同书
- 美术老师教学成果保护协议
- 人力资源外包合同范本
- 110KV送出线路工程施工组织设计方案和对策
- 城市交通系统中的空间正义问题-深度研究
- 2024年03月江苏2024年中国工商银行苏州分行社会招考笔试历年参考题库附带答案详解
- 2025年北师大新版高二物理上册阶段测试试卷
- 北师大版数学三下集体备课计划
- 《餐饮服务礼貌用语》课件
- 《机械制图》课程教案-任务四 滚动轴承的视图的绘制
- 钢结构防尘网拆除施工方案
- AQ 6111-2023个体防护装备安全管理规范知识培训
- 水浒传读书分享会
评论
0/150
提交评论