ImageVerifierCode 换一换
格式:DOCX , 页数:56 ,大小:3.39MB ,
资源ID:6887291      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/6887291.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(西南交大机电工程可视化大作业.docx)为本站会员(b****6)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

西南交大机电工程可视化大作业.docx

1、西南交大机电工程可视化大作业1.1 p=1 2 3; x=roots(p)x = -1.0000 + 1.4142i -1.0000 - 1.4142i1.2 a=3;b=4;c=5;l=(a+b+c)/2;S=sqrt(l*(l-a)*(l-b)*(l-c)S =61.3 A=1,2,0;1,3,1;0,1,2;B=1,0;0,1;-1,0;x=inv(A+2)*Bx = 1.2857 -1.4286 -0.4286 1.1429 -0.5714 -0.14291.4 x=1:19/9:20x = Columns 1 through 7 1.0000 3.1111 5.2222 7.3333

2、 9.4444 11.5556 13.6667 Columns 8 through 10 15.7778 17.8889 20.0000 y=x(2)y = 3.1111 x(1 2 3)=4 5 6x = Columns 1 through 7 4.0000 5.0000 6.0000 7.3333 9.4444 11.5556 13.6667 Columns 8 through 10 15.7778 17.8889 20.0000 z=x(5:-1:1)z = 9.4444 7.3333 6.0000 5.0000 4.0000 t=z(2:end)t = 7.3333 6.0000 5.

3、0000 4.00002.1 A=-5,0,1;2.6,1,2;0,8,1;B=4,2.5,0,;0,6,0;-1.2,0,1;ans=A&Bans = 1 0 0 0 1 0 0 0 1 ans=A|Bans = 1 1 1 1 1 1 1 1 1 ans=Aans = 0 1 0 0 0 0 1 0 02.2 A=2,1,0;1,2,1;0,1,2; det(A)ans = 4 inv(A)ans = 0.7500 -0.5000 0.2500 -0.5000 1.0000 -0.5000 0.2500 -0.5000 0.7500 E=eig(A)E = 0.5858 2.0000 3.

4、4142 L,U=lu(A)L = 1.0000 0 0 0.5000 1.0000 0 0 0.6667 1.0000U = 2.0000 1.0000 0 0 1.5000 1.0000 0 0 1.33332.3 a=9 1 2;5 6 3;8 2 7; L,U=lu(a)L = 1.0000 0 0 0.5556 1.0000 0 0.8889 0.2041 1.0000U = 9.0000 1.0000 2.0000 0 5.4444 1.8889 0 0 4.8367 Q,R=qr(a)Q = -0.6903 0.3969 -0.6050 -0.3835 -0.9097 -0.15

5、92 -0.6136 0.1221 0.7801R = -13.0384 -4.2183 -6.8260 0 -4.8172 -1.0807 0 0 3.7733 R=chol(a)R = 3.0000 0.3333 0.6667 0 2.4267 1.1447 0 0 2.29032.4 A=-4,-2,0,2,4;-3,-1,1,3,5; A(find(A4)ans = 52.5.1 A=1 2 3 4;3 4 5 6;5 6 7 8;7 8 9 0A = 1 2 3 4 3 4 5 6 5 6 7 8 7 8 9 0 B=A(1,2)B = 22.5.2 C=A(:,3)C = 3 5

6、7 92.5.3 D=A(1:3,2 4)D = 2 4 4 6 6 82.5.4 Aans = 1 3 5 7 2 4 6 8 3 5 7 9 4 6 8 02.5.5 fliplr(A)ans = 4 3 2 1 6 5 4 3 8 7 6 5 0 9 8 7 flipud(A)ans = 7 8 9 0 5 6 7 8 3 4 5 6 1 2 3 42.5.6 rot90(A,3)ans = 7 5 3 1 8 6 4 2 9 7 5 3 0 8 6 42.5.8 triu(A,-1)ans = 1 2 3 4 3 4 5 6 0 6 7 8 0 0 9 02.5.9 diag(A,2)

7、ans = 3 62.5.10 zeros(size(A)ans = 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ones(size(A)ans = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 12.5.12 A=1 2 3 4;3 4 5 6;5 6 7 8;7 8 9 0A = 1 2 3 4 3 4 5 6 5 6 7 8 7 8 9 0 A(:)=1:0.5:8.5A = 1.0000 3.0000 5.0000 7.0000 1.5000 3.5000 5.5000 7.5000 2.0000 4.0000 6.0000 8.00002.5000

8、4.5000 6.5000 8.50002.5.13 A(:,1 3)=A = 2 4 4 6 6 8 8 02.6.1 a=4 2;7 5; b=7 1;8 3; c=5 9;6 2; A=a(1:end);b(1:end);c(1:end)A = 4 7 2 5 7 8 1 3 5 6 9 2 Aans = 4 7 5 7 8 6 2 1 9 5 3 22.6.2 A=a(1:end),b(1:end),c(1:end)A = 4 7 2 5 7 8 1 3 5 6 9 23.1a=input(a=?)b=input(b=?)c=input(c=?)p=a b cx=roots(p)保存命

9、令文件x1x2.m x1x2a=?1a = 1b=?2b = 2c=?3c = 3p = 1 2 3x = -1.0000 + 1.4142i -1.0000 - 1.4142i3.2price=input(请输入商品价格:)a=fix(price/100)if a=0&a=2&a=5&a=10&a=25&a priceresult请输入商品价格:500price = 500rate = 0.0500price = 4753.3 A=magic(3)N=input(N=?) try A(N,:) catch A(end,:) end A Lasterr3.4 clearn=input(输入参数

10、数目:) if n=1 x1=input(输入参数x1:) m=input(输出参数数目:) if m=1 y1=x1 elseif m=2 y1=x1/2 y2=x1/2 else end elseif n=2 x1=input(输入参数x1:) x2=input(输入参数x2:) m=input(输出参数数目:) if m=1 y1=x1+x2 elseif m=2 y1=(x1+x2)/2 y2=(x1+x2)/2 else end else end 保存命令文件x1x2.m x1x2输入参数数目:2n = 2输入参数x1:5x1 = 5输入参数x2:6x2 = 6输出参数数目:2m =

11、 2y1 = 5.5000y2 =5.5000 3.5clears=0for n=1:50 s=s+n*(n+1)ends 保存命令文件sum.m sums = 442004.1 num=100;out_array=randn(1,1000000);tic;for ii=1:numfid,msg=fopen(unformatted.dat,w);count=fwrite(fid,out_array,float64);status=fclose(fid);endfprintf(Binary file=%6.3fn,toc);tic;for ii=1:numfid,msg=fopen(format

12、ted.dat,wt);count=fprintf(fid,%23.15en,out_array);status=fclose(fid);endfprintf(ASCII file=%6.3fn,toc);Binary file= 0.845ASCII file=170.7755.1 x=0:pi/100:2*pi; y1=sin(2*x); plot(x,y1) hold on y2=cos(x); plot(x,y2); hold off5.2 x,y=meshgrid(-8:0.5:8); z=sin(sqrt(x.2+y.2)./sqrt(x.2+y.2); mesh(x,y,z)5.

13、3 subplot(1,2,1);x=66 49 71 56 38;pie(x);title(饼图);subplot(1,2,2); pie(x(2),x(5); title(二 五);5.5 x,y=meshgrid(0:pi/100:pi);z=sin(pi*sqrt(x.2+y.2);mesh(x,y,z)5.6 x=-2*pi:pi/100:2*pi;y=-sin(-1*pi/3*x);plot(x,y)title(Plot of sin(theta));xlabel(-pileqthetaleqpi);ylabel(sin(theta));text(-0.5,-0.6,-sin(-p

14、i/3x);5.7 x,y=meshgrid(-2:0.1:2); z=x*exp(-x.2-y.2); subplot(2,2,1); surf(x,y,z); subplot(2,2,2); mesh(x,y,z); subplot(2,2,3); surf(x,y,z);shading flat; subplot(2,2,4); surf(x,y,z); light(posi,1,1,2); shading interp;5.8 t=0:0.5:10;y1=exp(-0.1*t); y2=exp(-0.2*t); y3=exp(-0.3*t);plot(t,y1,t,y2,k:,t,y3

15、,bp);text(3,0.3,a=0.3);text(6,0.3,a=0.2);text(8.6,0.5,a=0.1);5.9 x,y,z=peaks(30); surf(x,y,z);shading flat; colormap(copper);6.1 P=(x-1)*(x-2)*(x-3)*(x-4);Y=polyval(P,8)Y = 8406.2 x=0:0.02*pi:2*pi;Y=sin(x); max(Y)ans = 1 min(Y)ans = -1 mean(Y)ans = 2.2995e-017 std(Y)ans = 0.70716.3 A=1,1;2,4;b=36,10

16、0; x=Abx = 22 146.4 x=2 0 4 -5 0;y1=polyval(x,1)y1 = 1 y2=polyval(x,2)y2 = 38 y3=polyval(x,3)y3 = 183 y4=polyval(x,4)y4 = 556 A=1 2;3 4; y5=polyval(x,A) %对矩阵中各个元素的值y5 = 1 38 183 556 y6=polyvalm(x,A) %对矩阵的值y6 = 421 610 915 13366.5 h=6:2:18; t=18 20 22 25 30 28 24;15 19 24 28 34 32 30; X1=6.5:2:17.5 Y

17、1=interp1(h,t,X1,spline)X1 = 6.5000 8.5000 10.5000 12.5000 14.5000 16.5000Y1 = 18.5020 15.6553 20.4986 20.3355 22.5193 24.9089 26.3775 29.6383 30.2051 34.2568 26.8178 30.95947.1 f=sym(aex+bsinx)f =aex+bsinx7.2 syms x y7.3 f=3*x2+5*x+2f = 3*x2+5*x+2 %表达式 f=3*x2+5*x+2f =3*x2+5*x+2%单引号生成符号表达式 x=sym(x);

18、 f=3*x2+5*x+2f =3*x2+5*x+2%syms函数定义符号表达式7.4 syms x1 x2; x1=pi/3; x2=pi/6; eval( f1=(sin(x1)*cos(x2)-cos(x1)*sin(x2);f1 = 0.5000 eval(f2 =sin(x1-x2);f2 =0.50007.5.1 syms x;f=log(sin(x)/(pi-2*x)2; limit(f,x,pi/2) ans = -1/87.5.2 syms x; f=5*x*x/(1-x*x)+2(1/x); limit(f,x,inf) ans =-47.6.1 syms t; f=(1-

19、sqrt(t)/(1+sqrt(t); diff(f) ans =-1/2/t(1/2)/(1+t(1/2)-1/2*(1-t(1/2)/(1+t(1/2)2/t(1/2)7.6.2 syms x; f=exp(x)*cos(x); diff(x) ans = 1 7.7 syms x a; f=a x2 1/x;exp(a*x) log(x) sin(x); diff(f,x,1) ans = 0, 2*x, -1/x2 a*exp(a*x), 1/x, cos(x)7.8.1 syms x;f=sin(2*x)/sqrt(1+sin(x)2); int(f)ans =2*(1+sin(x)

20、2)(1/2)7.8.2 syms x;f=exp(x2/2);int(f,x,0,1)ans =-(2(1/2)*pi(1/2)*erf(2(1/2)*i)/2)*i)/27.9.1 syms x;f=x3;int(f,x,0,1)ans =1/47.9.2 syms x;f=(x2)*log(x);int(f,x,1,3) ans =9*log(3) - 26/97.10 syms x y;f1=x*y;f2=int(f1,x,0,1);f=int(f2)f = 1/4*y2 7.11 syms x y;s=solve(a*x2+b*y+c=0,x+y=0);disp(s.x); -1/2

21、/a*(-b+(b2-4*a*c)(1/2) -1/2/a*(-b-(b2-4*a*c)(1/2) disp(s.y) 1/2/a*(-b+(b2-4*a*c)(1/2) 1/2/a*(-b-(b2-4*a*c)(1/2)7.12 syms t;x=sin(3*t)*cos(t);y=sin(3*t)*sin(t);ezplot(x,y,0,2*pi)7.13 syms x t; A=2*x t2;t*sin(x) exp(x); diff(A,x)ans = 2, 0 t*cos(x), exp(x) diff(A,t)ans = 0, 2*t sin(x), 0 7.14 syms x y

22、 z;s=solve(x2+2*x+1=0,x+3*z=4,y*z=-1); disp(s.x)-1 disp(s.y)-3/5 disp(s.z)5/37.15.1建立函数文件function fx=funx(x)fx=x*2x-1保存funx.m z=fzero(funx,0)fx = -1fx = -1.0277fx = -0.9712.7.15.2建立函数文件function fx=funx(x)fx=3*sin(x)+1-x保存funx.m z=fzero(funx,0)fx = 1.fx = 1.1102e-016fx = -5.5511e-016fx = 1.1102e-016z

23、= -0.53858.1x=0:pi/20:4*pi;y1=sin(x);y2=cos(x);plot(x,y1,x,y2);get(gcf);h=get(gcf,children);hh=get(gca,children);y11=get(hh(1),ydata);y22=y11/2;set(hh(2),ydata,y22)set(hh(1),linestyle,:)set(hh(2),color,r)9.1 x=0:2:24;t=12,9,9,10,18,24,28,27,25,20,18,15,13;plot(x,t)P,S=polyfit(x,t,7);polyval(P,13)ans

24、 = 27.99729.2 x=0:1:6 10 12 15 16;y=1 7 23 109 307 400 307 123 69 24 6;n=9;p=polyfit(x,y,n);X=0:0.1:16;Y=polyval(p,X)plot(x,y,+,X,Y)9.3 x=1:1:5;y=1:1:3;x,y=meshgrid(x,y);z=82 82 80 82 84;79 63 61 65 81;84 84 82 85 86;subplot(1,2,1);surf(x,y,z);title(粗糙的平板表表面温度分布)xi=0:0.2:5;yi=0:0.2:3;xi,yi=meshgrid(

25、xi,yi);zi=interp2(x,y,z,xi,yi);subplot(1,2,2);surf(xi,yi,zi)title(平板表表面温度分布)9.4X=solve(x2+7*x+1);x1=X(1);x2=X(2);x=x1:0.1:x2;y=x.2+7*x+1;plot(x,y);s=-int(x2+7*x+1,x,x1,x2) disps =-(45*5(1/2)/29.5 x=0,300,600,1000,1500,2000;y=0.9689,0.9322,0.8969,0.8519,0.7989,0.7491;xi=0:100:2000;y0=1.0332*exp(-(xi+500)/7756);yi=interp1(x,y,xi,nearest);n=8;pp=polyfit(x,y,n);yj=polyval

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1