matlab实验9答案详解.doc_第1页
matlab实验9答案详解.doc_第2页
matlab实验9答案详解.doc_第3页
matlab实验9答案详解.doc_第4页
matlab实验9答案详解.doc_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

实验九 数值微积分与方程数值求解一、实验目的1. 掌握求数值导数和数值积分的方法2. 掌握代数方程数值求解方法3. 掌握常微分方程数值求解方法二、实验内容1.程序代码x=1;i=1;f=inline(det(x x2 x3;1 2*x 3*x2;0 2 6*x);while x0 %非齐次方程组 if rank(A)=rank(A,b) if rank(A)=n disp(有唯一解x); x=Ab; else disp(有无穷个解,特解x,基础解系y); x=Ab; y=null(A,r); end else disp(无解); x= ; endelse %齐次方程组 disp(有零解x); x=zeros(n,1); if rank(A) In line_solution at 11x = -2/11 10/11 0 0 y = 1/11 -9/11 -5/11 1/11 1 0 0 1 说明,其中为任意常数。5. (1)程序代码function g=f(x)g=3*x+sin(x)-exp(x);命令fzero(f,1.5)运行结果ans =1289/682 (2) 程序代码function F=fun(X)x=X(1); y=X(2); z=X(3); F(1)=sin(x)+y2+log(z)-7; F(2)=3*x+2-z3+1; F(3)=x+y+z-5; 命令 X=fsolve(myfun,1,1,1,optimset(Display,off)运行结果X = 909/1073 1735/728 1106/6256. 程序代码function f=g(u)x=u(1); y=u(2); f=2*x.3+4*x.*y3-10*x.*y+y.2;命令format longf=inline(x3+cos(x)+x*log(x)/exp(x);x,fmin1=fminbnd(f,0,1)U,fmin2=fminsearch(g,0,0)运行结果x = 0.52228834066617fmin1 = 0.39736346499846U = 1.00157013531668 0.83348828276574fmin2 = -3.324088491954237. 程序代码function xdot= sys(x,y)xdot=y(2);(5*y(2)-y(1)/x; 命令x0=1.0e-9;xf=20;x,y=ode45(sys,x0,xf,0 0);x,y 运行结果ans = 0.00000000100000 0 0 0.50000000097500 0 0 1.00000000095000 0 0 1.50000000092500 0 0 2.00000000090000 0 0 2.50000000087500 0 0 3.00000000085000 0 0 3.50000000082500 0 0 4.00000000080000 0 0 4.50000000077500 0 0 5.00000000075000 0 0 5.50000000072500 0 0 6.00000000070000 0 0 6.50000000067500 0 0 7.00000000065000 0 0 7.50000000062500 0 0 8.00000000060000 0 0 8.50000000057500 0 0 9.00000000055000 0 0 9.50000000052500 0 0 10.00000000050000 0 0 10.50000000047500 0 0 11.00000000045000 0 0 11.50000000042500 0 0 12.00000000040000 0 0 12.50000000037500 0 0 13.00000000035000 0 0 13.50000000032500 0 0 14.00000000030000 0 0 14.50000000027500 0 0 15.00000000025000 0 0 15.50000000022500 0 0 16.00000000020000 0 0 16.50000000017500 0 0 17.00000000015000 0 0 17.50000000012500 0 0 18.00000000010000 0 0 18.50000000007500 0 0 19.00000000005000 0 0 19.50000000002500 0 0 20.00000000000000 0 08. 程序代码function xdot=sys(x,y)xdot=y(2)*y(3);-y(1)*y(3);-0.51*y(1)*y(2); 命令t0=0;tf=8;x,y=ode23(sys,t0,tf,0,1,1)plot(x,y) 运行结果x = 0 0.00008000000000 0.00048000000000 0.00248000000000 0.01248000000000 0.06248000000000 0.16316648087424 0.30334485269993 0.48294833967376 0.71624621246687 0.98493918956028 1.26102936892963 1.56781298101399 1.95504167569316 2.32873602272301 2.70243036975286 3.01525347944023 3.29207876536554 3.48893042863855 3.64518246216301 3.75378914221393 3.86239582226485 3.99407711326142 4.16449735950485 4.38346049900962 4.65366905664880 4.92651991704096 5.22446717648585 5.58606842661006 6.03015135143159 6.34283742936188 6.65552350729217 6.93710062286368 7.15413202687009 7.32381272703587 7.45016281067983 7.57651289432379 7.70417366782409 7.87056646578704 8.00000000000000y = 0 1.00000000000000 1.00000000000000 0.00007999999987 0.99999999680000 0.99999999836800 0.00047999997217 0.99999988480001 0.99999994124800 0.00247999616133 0.99999692480378 0.99999843165111 0.01247951083310 0.99992212724247 0.99996028565141 0.06241866084392 0.99804966035035 0.99900580258575 0.16207993349816 0.98677077677398 0.99327512367842 0.29648257808915 0.95500730947069 0.97731281155849 0.45626180734456 0.88975128335880 0.94538299205165 0.63501989875064 0.77223119924652 0.89115403037424 0.79436723160944 0.60687889820281 0.82334517154014 0.90691719876177 0.42032320550870 0.76171275015507 0.97795854279956 0.20660136122494 0.71547587549052 0.99746157200322 -0.06435382609456 0.70161030203131 0.94495832536325 -0.32577476314727 0.73774616015903 0.81273846068860 -0.58169326760580 0.81411075040892 0.63026715596716 -0.77548304089530 0.89273549643704 0.41296879043399 -0.90977435655485 0.95521547207918 0.23239805938823 -0.97163632839229 0.98579902579032 0.07945302792639 -0.99584330144411 0.99804308400598 -0.02887649481307 -0.99858177100716 0.99943757138815 -0.13669190064326 -0.98959458697952 0.99486819989785 -0.26403522164101 -0.96344776762242 0.98169211459246 -0.41874355211670 -0.90692284918313 0.95383599928875 -0.59348683151203 -0.80338578881180 0.90526486000873 -0.76435277266500 -0.64273606310776 0.83729511626613 -0.88586008956222 -0.46089846565828 0.77379347428854 -0.96564631710271 -0.25417823959890 0.72346612824858 -0.99852052429922 -0.00136968722324 0.70033669091483 -0.94946582197601 0.30917649189383 0.73430745677015 -0.84954447765781 0.52467093998805 0.79427803150432 -0.68575520763787 0.72561102860141 0.87124443849711 -0.48022003592803 0.87511116358204 0.93870074301866 -0.28880511014799 0.95541991873655 0.97782577819325 -0.12536463543148 0.99016523362993 0.99529929352736 0.0001575432219

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论