中南大学matlab课后习题_第1页
中南大学matlab课后习题_第2页
中南大学matlab课后习题_第3页
中南大学matlab课后习题_第4页
中南大学matlab课后习题_第5页
已阅读5页,还剩52页未读 继续免费阅读

下载本文档

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

文档简介

1、MATLAB程序设计上机练习课后题 电科1202班 行晓慧 学号1404120229 电科1202班 羊月妹 学号1404120304电科1202班 周悦 学号1404120316第一章一实验内容1. 打开软件,按照步骤:File - Set Path - Add Folder - save 在盘中建立一个名为matlab的工作目录,然后在命令窗口运行>>help命令查询所设置的工作目录,观察结果。2.源代码例1-1x=0:0.5:360*pi/180;plot(x,sin(x),x,cos(

2、x);例1-2p=3,7,9,0,-23;x=roots(p)例1-3quad('x.*log(1+x)',0,1)syms x int(x*log(1+x),0,1)例1-4 a=2,-3,1;8,3,2;45,1,-9;b=4;2;17;x=inv(a)*b syms x y zx,y,z=solve(2*x-3*y+z-4,8*x+3*y+2*z-2,45*x+y-9*z-17)MATLAB的主要优点:编程效率高;用户使用方便;扩展能力强,交互性好;移植性和开发性好;语句简单,内涵丰富;高效方便的矩阵和数组运算;方便的绘图功能。3. 利用MATLAB的帮助功能,查询了解到

3、inv 、plot、 max 、round等函数的功能与用法如下:Inv取矩阵的逆。Plot绘制平面图      INV Matrix inverse.PLOT Linear plot. Max 求最大值                     help

4、60;round   四舍五入  MAX Largest component. ROUND  Round towards nearest integer. 4. x=0:pi/10:2*pi;y=sin(x);y的图形如图:  纵轴是y的值,x是将【0:2pi】分为20等分思考练习:1. 启动MATLAB系统有3种常见方法: (1)使用Windows“开始”菜单。 (2)运行MATLAB 系统启动程序matlab.exe。 (3) 利用快捷方式。 要退出M

5、ATLAB系统,也有3种常见方法: (1) 在MATLAB主窗口File菜单中选中Exit MATLAB命令。 (2) 在MATLAB命令窗口输入Exit或Quit命令。 (3) 单击MATLAB主窗口的“关闭”按钮。2. matlab的主要功能数值计算、符号计算、优化工具、数据分析和可视化功能、工具箱和非线性动态系统建模和仿真3. 如果一个MATLAB命令包含的字符很多,需要分成多行输入,只要同时按下shift和Enter键即可。4. Lookfor与help的区别: 在所有M文件中找“关键词”,比如:lookfor max, 而help是显示matlab内置的

6、帮助信息,比如 help inv。5. 在Matlab环境下,同名变量与M文件的执行问题:       % 可以调用,为了避开当前工作间(Worrkspace),采用函数调用方式      function runfac(fname)       run fname        

7、;                  % 保存为 runfac.m       .      >>runfac(fac) 第二章实验指导1.(1) w=sqrt(2)*(1+0.34245*10(-6)w = 1.4142(2) a=3.5;b=5;c=-9.8;x=

8、(2*pi*a+(b+c)/(pi+a*b*c)-exp(2)/(tan(b+c)+a)x =0.9829(3) a=3.32;b=-7.9;y=2*pi*a2*(1-pi/4)*b-(0.8333-pi/4)*a)y = -128.4271(4) t=2,1-3i;5,-0.65;z=0.5*exp(2*t)*log(t+sqrt(1+t*t)z = 1.0e+004 * 0.0048 + 0.0002i 0.0048 - 0.0034i 1.5899 2.0090 - 1.3580i2(1)(2)(3)>> A=-1,5,-4;0,7,8;3,61,7;B=8,3,-1;2,5

9、,3,;-3,2,0;>> Y1=A+6*BY1 = 47 23 -10 12 37 26 -15 73 7>> Y2=A*A-B+1Y2 = -18 -216 18 23 533 110 22 868 526>> Y3=A*BY3 = 14 14 16 -10 51 21 125 328 180>> Y4=A.*BY4 = -8 15 4 0 35 24-9 122 0>> Y5=A/BY5 = 1.2234 -0.9255 2.9787 -0.9468 2.3511 -0.9574 4.6170 3.8723 13.8936>

10、;> Y6=BAY6 = -0.5106 -8.6170 -1.1277 0.7340 17.5745 1.8085 -0.8830 -21.2128 0.4043>> Y7=A,BY7 = -1 5 -4 8 3 -1 0 7 8 2 5 3 3 61 7 -3 2 0>> Y8=A(1,3,:);B2Y8 = -1 5 -4 3 61 7 73 37 1 17 37 13 -20 1 9>>3.A=23,10,-0.778,0;41,-45,65,5;32,5,0,32;6,-9.54,54,3.14;k=find(A>=10&A&l

11、t;=25)A(k)B=A(1:3,:)C=A(:,1:2)D=A(2:4,3:4)E=B*CE<DE&DE|DE|Dk = 1 5ans = 23 10B = 23.0000 10.0000 -0.7780 0 41.0000 -45.0000 65.0000 5.0000 32.0000 5.0000 0 32.0000C = 23.0000 10.0000 41.0000 -45.0000 32.0000 5.0000 6.0000 -9.5400D = 65.0000 5.0000 0 32.0000 54.0000 3.1400E = 1.0e+003 * 0.9141

12、 -0.2239 1.2080 2.7123 1.1330 -0.2103ans = 0 1 0 0 0 1ans = 1 1 0 1 1 1ans = 1 1 1 1 1 1ans = 0 0 1 0 0 0>>4 H=hilb(5); P=pascal(5); Hh=det(H)Hh = 3.7493e-012Hp=det(P)Hp = 1Th=cond(H)Th = 4.7661e+005Tp=cond(P)Tp = 8.5175e+003条件数越趋近于1,矩阵的性能越好,所以帕斯卡矩阵性能更好。5 A=-29,6,18;20,5,12;-8,8,5A = -29 6 18

13、20 5 12 -8 8 5V,D=eig(A)V = 0.7130 0.2803 0.2733 -0.6084 -0.7867 0.8725 0.3487 0.5501 0.4050D = -25.3169 0 0 0 -10.5182 0 0 0 16.8351V为A的特征向量,D为A的特征值。它们之间满足A*V=V*D思考练习1. 在MATLAB中6+7i是一个复数常量,6+7*i则是一个表达式。i是虚数单位,而I是单位向量。2. A.*B表示A和B单个元素之间对应相乘,A*B是按矩阵乘法的规则乘。A./B表示A矩阵除以B矩阵的对应元素,B.A等价于A./B。A/B表示A *inv(B)

14、而BA表示inv(B)* A,对于矩阵运算一般两式不等。3.(1) A(7)=(2) abs(x)(3) reshape(x,3,4)(4) k=find(t=0); t(k)=0(5) ones(size(A)(6) diag(A)B= diag(diag(A)4. 3+randn(25,20)5.(1)A=1,-1,2,3;5,1,-4,2;3,0,5,2;11,15,0,9;D=diag(A)B=triu(A)C=tril(A)E=inv(A)F=det(A)r=rank(A)a1=norm(A,1)a2=norm(A)ainf=norm(A,inf)C1=cond(A)trace(A)

15、D = 1 1 5 9B = 1 -1 2 3 0 1 -4 2 0 0 5 2 0 0 0 9C = 1 0 0 0 5 1 0 0 3 0 5 0 11 15 0 9E = -0.1758 0.1641 0.2016 -0.0227 -0.1055 -0.1016 -0.0391 0.0664 -0.0508 -0.0859 0.1516 0.0023 0.3906 -0.0313 -0.1813 0.0281F = 1280r = 4a1 = 20a2 = 21.3005ainf = 35C1 = 11.1739ans = 16(2)A=0.43,43,2;-8.9,4,21;D=dia

16、g(A)B=triu(A)C=tril(A)r=rank(A)a1=norm(A,1)a2=norm(A)ainf=norm(A,inf)C1=cond(A)trace(A)D = 1 1 5 9B = 1 -1 2 3 0 1 -4 2 0 0 5 2 0 0 0 9C = 1 0 0 0 5 1 0 0 3 0 5 011 15 0 9r = 4a1 = 20a2 = 21.3005ainf = 35C1 = 11.1739ans = 166. A=34,NaN,Inf,-Inf,-pi,eps,0;all(A)ans = 0any(A)ans = 1isnan(A)ans = 0 1 0

17、 0 0 0 0isinf(A)ans = 0 0 1 1 0 0 0isfinite(A)ans = 1 0 0 0 1 1 17.结构矩阵建立P46 结构矩阵名.成员名=表达式单元矩阵建立 P47 矩阵元素用大括号括起来。8用稀疏存储方式可以可以节省内存空间; 运算规则上,稀疏矩阵与普通矩阵一样,只是矩阵的存储方式不同。在运算过程中,稀疏存储矩阵可以直接参与运算。当参与运算的对象不全是稀疏存储矩阵时,所得结果一般是完全存储形式。第三章;实验指导;1、 n=input('请输入一个三位数:');a=fix(n/100);b=fix(n-a*100)/10);c=n-a*100

18、-b*10;d=c*100+b*10+a2(1)n=input('请输入成绩');switch ncase num2cell(90:100) p='A'case num2cell(80:89) p='B'case num2cell(70:79) p='C'case num2cell(60:69) p='D'otherwise p='E'endprice=p(2)n=input('请输入成绩');if n>=90&n<=100 p='A'elseif

19、 n>=80&n<=89 p='B'elseif n>=70&n<=79 p='C'elseif n>=60&n<=69 p='D'else p='E'endprice=p(3)try n;catch price='erroe'end3n=1,5,56,4,3,476,45,6,3,76,45,6,4,3,6,4,23,76,908,6;a=n(1);b=n(1);for m=2:20 if n(m)>a a=n(m); elseif n(m)<

20、;b b=n(m); endendmax=amin=b法2n=1,5,56,4,3,476,45,6,3,76,45,6,4,3,6,4,23,76,908,6;min=min(n)max=max(n)4b=-3.0:0.1:3.0;for n=1:61 a=b(n);y(n)=(exp(0.3*a)-exp(-0.3*a)/2*sin(a+0.3)+log(0.3+a)/2);endy5y1=0;y2=1;n=input('请输入n的值:');for i=1:n y1=y1+1/i2; y2=y2*(4*i*i)/(2*i-1)*(2*i+1);endy1y26A=1,1,1

21、,1,1,1;2,2,2,2,2,2;3,3,3,3,3,3;4,4,4,4,4,4;5,5,5,5,5,5;6,6,6,6,6,6;n=input('请输入n的值:');if n<=5&n>=0 disp(A(n,:);elseif n<0 disp(lasterr);else disp(A(6,:); disp(lasterr);end 7(1)f=;for n=1:40 f(n)=n+10*log(n2+5);end y=f(40)/(f(30)+f(20)(2)f=;a=0;for n=1:40 f(n)=a+n*(n+1); a=f(n);e

22、ndy=f(40)/(f(30)+f(20)8y=0;m=input('输入m的值:');n=input('输入n值:');for i=1:n y=y+im;endy*function s=shi8_1(n,m)s=0;for i=1:n s=s+im;end*shi8_1(100,1)+shi8_1(50,2)+shi8_1(10,1/2)思考练习1用MATLAB语言编写的程序,称为M文件。为建立新的M文件,启动MATLAB文本编辑器有3种方法: (1) 菜单操作。从MATLAB主窗口的File菜单中选择New菜单项,再选择M-file命令,屏幕上将出现MAT

23、LAB 文本编辑器窗口。 (2) 命令操作。在MATLAB命令窗口输入命令edit,启动MATLAB文本编辑器后,输入M文件的内容并存盘。 (3) 命令按钮操作。单击MATLAB主窗口工具栏上的New M-File命令按钮,启动MATLAB文本编辑器后,输入M文件的内容并存盘。 打开已有的M文件,也有3种方法: (1) 菜单操作。从MATLAB主窗口的File菜单中选择Open命令,则屏幕出现Open对话框,在Open对话框中选中所需打开的M文件。在文档窗口可以对打开的M文件进行编辑修改,编辑完成后,将M文件存盘。 (2) 命令操作。在MATLAB命令窗口输入命令:edit 文件名,则打开指定

24、的M文件。(3) 命令按钮操作。单击MATLAB主窗口工具栏上的Open File命令按钮,再从弹出的对话框中选择所需打开的M文件。2N=1,2,3,4,5;2.*NN./21./N1./N.23s=fix(100*rand(1,20)*9/10+10)y=sum(s)/20j=0;for i=1:20 if s(i)<y&rem(s(i),2)=0 j=j+1; A(j)=s(i); else continue; endendA4y1=0;y2=0;n=input('请输入n的值:');for i=1:n y1=y1+-(-1)i/(2*i-1); y2=y2+

25、1/4i;endy1y25、function m,n=chengji(A,B)m=a.*b;n=a*b;a=1 2 3;4 5 6;7 8 9b=-1 0 1;1 -1 0;0 1 1m,n=chengji(a,b);disp('a.*b=');disp(m);disp('a*b= ');disp(n);6.>>function f = BaiduZd( shu ,Z,n )%UNTITLED2 Summary of this function goes here% Detailed explanation goes hereswitch Z cas

26、e 'sin' f=sin(shu); case 'cos' f=cos(shu); case 'log' f=log(shu); case 'zhishu' f=shun otherwise disp('error')endend第四章实验指导1(1)x=-10:0.05:10;y=x-x.3./6;plot(x,y) (2)x=-10:0.5:10;ezplot('x2+2*y2-64',-8,8); grid on;2、t=-pi:pi/10:pi; y=1./(1+exp(-t); subp

27、lot(2,2,1);bar(t,y); title('ÌõÐÎͼ(t,y)'); axis(-pi,pi,0,1); subplot(2,2,2); stairs(t,y,'b'); title('½×ÌÝͼ(t,y)'); axis(-pi,pi,0,1); subplot(2,2,3); stem(t,y,'k'); title('¸Ëͼ(t,y)

28、9;); axis(-pi,pi,0,1); subplot(2,2,4); loglog(t,y,'y'); title('¶ÔÊý×ø±êͼ(t,y)');3、(1)t=0:pi/50:2*pi; r=5.*cos(t)+4; polar(t,r); title('rho=5*costheta+4');(2)t=-pi/3:pi/50:pi/3; r=5.*(sin(t).2)./cos(t); polar(t,r);4(1)t=0:pi/5

29、0:2*pi; x=exp(-t./20).*cos(t); y=exp(-t./20).*sin(t); z=t; plot3(x,y,z); grid on; (2)x,y=meshgrid(-5:5); z=zeros(11)+5; mesh(x,y,z); shading interp;5、x,y,z=sphere(20); surf(x,y,z); axis off; shading interp; m=moviein(20); for i=1:20 axis(-i,i,-i,i,-i,i) m(:,i)=getframe;endmovie(m,4);思考练习:1、在同一坐标轴绘制多

30、条二维曲线的方法:(1)利用plot函数,输入参数是矩阵形式;(2)利用plot函数,其里面的参数是多组向量对。2、(1)x=-5:0.1:5; y=(1./(2*pi).*exp(-(x.2)/2); plot(x,y); (2)t=-2*pi:0.1:2*pi; x=t.*sin(t); y=t.*cos(t); plot(x,y); grid on; 3、t=0:pi/1000:pi; x=sin(3.*t).*cos(t); y1=sin(3.*t).*sin(t); y2=2.*x-0.5; plot(x,y1,'k',x,y2); hold on;k=find(ab

31、s(y1-y2)<1e-2); x1=x(k); y3=2.*x1-0.5; plot(x1,y3,'rp'); 4、x=-2:0.01:2;y=sin(1./x);subplot(2,1,1);plot(x,y);subplot(2,1,2);fplot('sin(1./x)',-2,2,1e-4); 两曲线的不同:利用fplot绘制的曲线靠近坐标轴中心处比plot绘制的密集。5、(1)i=-4*pi:0.1:10;j=12./sqrt(i);polar(i,j);title('rho=12/sqrt(theta)')(2)a=-pi/6

32、:0.01:pi/6;b=3.*asin(a).*cos(a)./(sin(a).3+(cos(a).3);polar(a,b); 6、(1)u,v=meshgrid(-4:0.1:4);x=3.*u.*sin(v);y=2.*u.*cos(v);z=4.*u.2;subplot(2,1,1);mesh(x,y,z);subplot(2,1,2);surf(x,y,z);(2) u,v=meshgrid(-4:0.1:4);x=3.*u.*sin(v);y=2.*u.*cos(v);z=4.*u.2;subplot(2,1,1);mesh(x,y,z);subplot(2,1,2);surf(

33、x,y,z);第五章一、实验内容1.A=randn(10,5)x=mean(A) y=std(A)  Max=max(max(A) Min=min(min(A) Sumhang=sum(A,2) SumA=sum(Sumhang) B=sort(A); C=sort(B,2,'descend'); C2(1) a=0:15:90; b=a./180.*pi; s=sin(b) c=0:15:75; d=c./180.*pi; t=tan(d

34、) e=input('请输入想计算的值:'); S=sin(e/180*pi) T=tan(e/180*pi) S1=interp1(a,s,e,'spline') T1=interp1(c,t,e,'spline')  P1=polyfit(a,s,5); P2=polyfit(c,t,5); S2=polyval(P1,e) T2=polyval(P2,e)(2) n=1,9,16,25,36,49,64,81,100; N

35、=sqrt(n); x=input('ji suan zhi : '); interp1(n,N,x,'cubic') 3  N=64; T=5; t=linspace(0,T,N); h=exp(-t); dt=t(2)-t(1); f=1/dt; X=fft(t); F=X(1:N/2+1); f=f*(0:N/2)/N; plot(f,abs(F),'-*') 4

36、  P=2,-3,0,5,13; Q=1,5,8; p=polyder(P) q=polyder(P,Q)  a,b=polyder(P,Q)5 P1=1,2,4,0,5; P2=0,1,2; P3=1,2,3; P=P1+conv(P2,P3) X=roots(P) A=-1,1.2,-1.4;0.75,2,3.5;0,5,2.5; p=polyval(P,A)二、思考练习1. 函数sum与cumsum的差别:sum是数据序列求和的函数。Cumsum是累加指从数据序列的第1

37、个元素开始直到当前元素进行累加,作为结果序列的当前元素值。在MATLAB中,使用cumsum函数求得向量和矩阵元素的累加。2.在工程测量和科学实验中,所得到的数据通常是离散的。如果要得到这些离散点以外的其他点的数值,就需要根据这些已知数据进行插值。 与数据插值类似,曲线拟合的目的也是用一个比较简单的函数去逼近一个复杂的或未知函数,所依据的条件都是在一个区间或一个区域上的有限个采样点的函数值。3.在matlab中,N次多项式是用一个长度为n+1的向量来表示,缺少的幂次项系数为0。4 、A=rand(1,30000); a=mean(A) b=std(A) 

38、Max=max(A) Min=min(A) n=0; for i=1:30000     if(A(i)>0.5)          n=n+1;      end end n y=n/300005 、p=45,74,54,55,14;78,98,45,74,12;87,98,85,52,65 M,S=max(p

39、) N,H=min(p) junzhi=mean(p,1) fangcha=std(p,1,1) zong=sum(p,2); Max,wei=max(zong) Min,wei=min(zong) zcj,xsxh=sort(zong,'descend') 6 、x=1:10:101; y=0,1.0414,1.3222,1.4914,1.6128,1.7076,1.7853,1.8513,1.9085,1.9590,2.0043; p,s=polyfit(x,y,5

40、) a=1:5:101; y1=polyval(p,a); plot(x,y,':o',a,y1,'-*') 第六章实验指导1、A=1/2,1/3,1/4;1/3,1/4,1/5;1/4,1/5,1/6;p=0.95,0.67,0.52'x=ApA=1/2,1/3,1/4;1/3,1/4,1/5;1/4,1/5,1/6;p=0.95,0.67,0.53'x=Apcond(A)x = 1.2000 0.6000 0.6000x = 3.0000 -6.6000 6.6000ans = 1.3533e+0032

41、(1)function fx=funx1(x)fx=x41+x3+1; %建立函数文件x1=fzero(funx1,-1)x1 = -0.9525(2)function fx=funx2(x)fx=x-sin(x)/x; %建立函数文件x2=fzero(funx2,0.5)x2 = 0.8767(3)function q=fun3(p)x=p(1);y=p(2);z=p(3);q(1)=sin(x)+y2+log(z)-7;q(2)=3*x+2y-z3+1;q(3)=x+y+z-5; %建立函数文件options=optimset('Display','off'

42、);x=fsolve(fun3,1,1,1',options)q=fun3(x)x = 0.5991 2.3959 2.0050q = 1.0e-010 * 0.2213 0.3804 0.00093(1)function yp=fun4(t,y)yp=-(1.2+sin(10*t)*y; %建立函数文件t0=0;tf=5;y0=1;t,y=ode23(fun4,t0,tf,y0);t'y'ans = Columns 1 through 10 0 0.0667 0.1375 0.2003 0.2695 0.3528 0.4362 0.5033 0.5663 0.6369

43、 Columns 11 through 20 0.6913 0.7457 0.8081 0.8738 0.9591 1.0277 1.0963 1.1600 1.2246 1.3082 Columns 21 through 30 1.3714 1.4347 1.5001 1.5842 1.6530 1.7219 1.7858 1.8501 1.9319 1.9953 Columns 31 through 40 2.0587 2.1236 2.2053 2.2745 2.3438 2.4080 2.4719 2.5501 2.6140 2.6779 Columns 41 through 50 2

44、.7419 2.8193 2.9046 2.9685 3.0323 3.0959 3.1721 3.2364 3.3007 3.3642 Columns 51 through 60 3.4395 3.5328 3.5965 3.6602 3.7238 3.7998 3.8642 3.9286 3.9920 4.0671 Columns 61 through 70 4.1408 4.2144 4.2800 4.3432 4.4159 4.4812 4.5465 4.6094 4.6812 4.7567 Columns 71 through 74 4.8322 4.8990 4.9620 5.00

45、00ans = Columns 1 through 10 1.0000 0.9035 0.7822 0.6823 0.5984 0.5402 0.5182 0.5106 0.4976 0.4656 Columns 11 through 20 0.4280 0.3844 0.3355 0.2936 0.2595 0.2469 0.2421 0.2382 0.2290 0.2054 Columns 21 through 30 0.1819 0.1585 0.1387 0.1225 0.1164 0.1140 0.1122 0.1080 0.0974 0.0864 Columns 31 throug

46、h 40 0.0753 0.0658 0.0581 0.0549 0.0537 0.0529 0.0511 0.0466 0.0415 0.0361 Columns 41 through 50 0.0316 0.0278 0.0258 0.0253 0.0249 0.0241 0.0221 0.0197 0.0172 0.0150 Columns 51 through 60 0.0132 0.0122 0.0119 0.0117 0.0114 0.0104 0.0093 0.0081 0.0071 0.0062 Columns 61 through 70 0.0058 0.0056 0.005

47、5 0.0054 0.0050 0.0045 0.0039 0.0034 0.0030 0.0027 Columns 71 through 74 0.0026 0.0026 0.0025 0.0025>>(2)function yp=fun5(t,y)yp=cos(t)-y/(1+t2); %建立函数文件t0=0;tf=5;y0=1;t,y=ode23(fun5,t0,tf,y0);t'y'ans = Columns 1 through 10 0 0.5000 0.8016 1.1033 1.4077 1.7537 2.2301 2.5215 2.8129 2.97

48、27 Columns 11 through 18 3.1326 3.3001 3.5091 3.7549 4.0375 4.3637 4.7584 5.0000ans = Columns 1 through 10 1.0000 1.0146 1.0363 1.0450 1.0162 0.9157 0.6451 0.4122 0.1437 -0.0122 Columns 11 through 18 -0.1699 -0.3330 -0.5273 -0.7327 -0.9233 -1.0649 -1.1040 -1.05344 function fx=mymin(x)fx=-(1+x.2)/(1+

49、x.4); %建立函数文件x=fminbnd(mymin,0,2);-mymin(x)ans = 1.20715 function f=fun6(x)f=-(sqrt(x(1)+(400-x(1)*1.1+(sqrt(x(2)+(400-x(1)*1.1-x(2)*1.1+sqrt(3)+(400-x(1)*1.1-x(2)*1.1-x(3)*1.1+sqrt(x(x4); %建立函数文件options=optimset('Display','off');x,fval=fmincon(fun6,0,0,0,a,b,lb,ub)-fval思考练习1(1)A=2,3

50、,5;3,7,4;1,-7,1;B=10,3,5'C1=inv(A)*BC2=ABL,U=lu(A);x=U(LB)C1 = -1.8060 -0.5373 3.0448C2 = -1.8060 -0.5373 3.0448x = -1.8060 -0.5373 3.0448(2)A=6,5,-2,5;9,-1,4,-1;3,4,2,-2;3,-9,0,2;B=-4,13,1,11'C1=inv(A)*BC2=ABL,U=lu(A);x=U(LB)C1 = 0.6667 -1.0000 1.5000 0.0000C2 = 0.6667 -1.0000 1.5000 -0.0000x = 0.6667 -1.0000 1.5000 -0.00002(1)function fx=funx1(x)fx=3*x+sin(x)-exp(x); %建立函数文件x1=fzero(funx1,1.5)x1 = 1.8900(2)function fx=funx2(x)fx=x-1/x+5; %建立函数文件x1=fzero(funx2,1)x1 = 0.1926(3)function q=fun3(p)x=p(1);y=p(2);q(1)=x2+y2-9;q(2)=x+y-1; %建立函数文件options=optimset('Display','off&

温馨提示

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

评论

0/150

提交评论