[理学]MATLAB刘卫国版本.doc
《[理学]MATLAB刘卫国版本.doc》由会员分享,可在线阅读,更多相关《[理学]MATLAB刘卫国版本.doc(58页珍藏版)》请在三一办公上搜索。
1、海 南 大 学MATLAB 实验(刘卫国版本)题 目: MATLAB 实验 学 号: 2009050* 姓 名: * 年 级: 09电气 学 院: 机电工程学院 系 别: 电气工程系 专 业: 电气工程及其自动化 实验一 MATLAB运算基础二(1)二、实验内容1.先求下列表达式的值,然后显示MATLAB工作空间的使用情况并保存全部变量。 ;程序为 z1=2*sin(85*pi/180)/(1+exp(2)z1 = 0.2375,其中; x=2 1+2i;-0.45 5; z2=1/2*log(x+sqrt(1+x2)z2 = 0.7114 - 0.0253i 0.8968 + 0.3658i
2、 0.2139 + 0.9343i 1.1541 - 0.0044i程序为 a=(-3.0:0.1:3.0); z3=(exp(0.3.*a)-exp(-0.3.*a)./2.*sin(a+0.3)+log(0.3+a)./2)z3 = Columns 1 through 3 0.7388 + 3.1416i 0.7696 + 3.1416i 0.7871 + 3.1416i Columns 4 through 6 0.7913 + 3.1416i 0.7822 + 3.1416i 0.7602 + 3.1416i Columns 7 through 9 0.7254 + 3.1416i 0.
3、6784 + 3.1416i 0.6196 + 3.1416i Columns 10 through 12 0.5496 + 3.1416i 0.4688 + 3.1416i 0.3780 + 3.1416i Columns 13 through 15 0.2775 + 3.1416i 0.1680 + 3.1416i 0.0497 + 3.1416i Columns 16 through 18 -0.0771 + 3.1416i -0.2124 + 3.1416i -0.3566 + 3.1416i Columns 19 through 21 -0.5104 + 3.1416i -0.675
4、2 + 3.1416i -0.8536 + 3.1416i Columns 22 through 24 -1.0497 + 3.1416i -1.2701 + 3.1416i -1.5271 + 3.1416i Columns 25 through 27 -1.8436 + 3.1416i -2.2727 + 3.1416i -2.9837 + 3.1416i Columns 28 through 30 -37.0245 -3.0017 -2.3085 Columns 31 through 33 -1.8971 -1.5978 -1.3575 Columns 34 through 36 -1.
5、1531 -0.9723 -0.8083 Columns 37 through 39 -0.6567 -0.5151 -0.3819 Columns 40 through 42 -0.2561 -0.1374 -0.0255 Columns 43 through 45 0.0792 0.1766 0.2663 Columns 46 through 48 0.3478 0.4206 0.4841 Columns 49 through 51 0.5379 0.5815 0.6145 Columns 52 through 54 0.6366 0.6474 0.6470 Columns 55 thro
6、ugh 57 0.6351 0.6119 0.5777 Columns 58 through 60 0.5327 0.4774 0.4126 Column 61 0.3388 ,其中程序为 t=(0:0.5:2.5); z4=(t=0&t=1&t2).*(t.2-1)+(2=t&t A=12 34 -4;34 7 87;3 65 7; B=1 3 -1;2 0 3;3 -2 7; I=1 0 0;0 1 0;0 0 1; A+6*Bans = 18 52 -10 46 7 105 21 53 49 A-B+Ians = 12 31 -3 32 8 84 0 67 1 A3ans = 37226
7、 233824 48604 247370 149188 600766 78688 454142 118820 A.3ans = 1728 39304 -64 39304 343 658503 27 274625 343 A/Bans = 16.4000 -13.6000 7.6000 35.8000 -76.2000 50.2000 67.0000 -134.0000 68.0000 BAans = 109.4000 -131.2000 322.8000 -53.0000 85.0000 -171.0000 -61.6000 89.8000 -186.2000 A,Bans = 12 34 -
8、4 1 3 -1 34 7 87 2 0 3 3 65 7 3 -2 7 A(1,3,:);B2ans = 12 34 -4 3 65 7 4 5 1 11 0 19 20 -5 403.设有矩阵A和B:求它们的乘积C;将矩阵C的右下角子矩阵赋给D;查看MATLAB工作空间的使用情况。程序为 A=1 2 3 4 5;6 7 8 9 10;11 12 13 14 15;16 17 18 19 20;21 22 23 24 25; B=3 0 16;17 -6 9 ;0 23 -4;9 7 0;4 13 11; C=A*BC = 93 150 77 258 335 237 423 520 397
9、588 705 557 753 890 717 D=C(3,4,5,2,3)D = 520 397 705 557 890 717 whos Name Size Bytes Class Attributes A 5x5 200 double B 5x3 120 double C 5x3 120 double D 3x2 48 double 4.完成下列操作:求100,999之间能被21整除的数的个数;建立一个字符串向量,删除其中的大写字母。程序为 A=100:1:999;K=find(rem(A,21)=0); length(K)ans = 43 ch=aHDJLK143663CFHI; H=
10、find(ch=A&ch ch(H)= ch =a143663实验二 MATLAB矩阵分析与处理二(1)E=eye(3);R=rand(3,2);O=zeros(2,3);S=diag(2,3);A=E,R;O,S;A2B=E,(R+R*S);O,S2ans = 1.0000 0 0 2.8504 1.9439 0 1.0000 0 0.6934 3.5652 0 0 1.0000 1.8205 3.0484 0 0 0 4.0000 0 0 0 0 0 9.0000B = 1.0000 0 0 2.8504 1.9439 0 1.0000 0 0.6934 3.5652 0 0 1.0000
11、 1.8205 3.0484 0 0 0 4.0000 0 0 0 0 0 9.0000(2) H=hilb(5)P=pascal(5)Hh=det(H)Hp=det(P)Th=cond(H)Tp=cond(P)H = 1.0000 0.5000 0.3333 0.2500 0.2000 0.5000 0.3333 0.2500 0.2000 0.1667 0.3333 0.2500 0.2000 0.1667 0.1429 0.2500 0.2000 0.1667 0.1429 0.1250 0.2000 0.1667 0.1429 0.1250 0.1111P = 1 1 1 1 1 1
12、2 3 4 5 1 3 6 10 15 1 4 10 20 35 1 5 15 35 70Hh = 3.7493e-012Hp = 1Th = 4.7661e+005Tp = 8.5175e+003(3) A=fix(10*rand(5)H=det(A)Trace=trace(A)Rank=rank(A)Norm=norm(A)A = 7 8 0 7 6 4 5 6 4 3 9 2 3 3 5 4 6 8 1 1 4 8 5 1 6H = -6498Trace = 22Rank = 5Norm = 23.8478(4) A=-29,6,18;20,5,12;-8,8,5V,D=eig(A)%数
13、学意义略A = -29 6 18 20 5 12 -8 8 5V = 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.8351(5)A=hilb(4)A(:,1)=A(4,:)=B=0.95,0.67,0.52;X=inv(A)*BB1=0.95,0.67,0.53;X1=inv(A)*B1N=cond(B)N1=cond(B1)Na=cond(A) %矩阵A为病态矩阵A = 1.0000 0.5000 0.3333 0.2500 0.500
14、0 0.3333 0.2500 0.2000 0.3333 0.2500 0.2000 0.1667 0.2500 0.2000 0.1667 0.1429A = 0.5000 0.3333 0.2500 0.3333 0.2500 0.2000 0.2500 0.2000 0.1667 0.2000 0.1667 0.1429A = 0.5000 0.3333 0.2500 0.3333 0.2500 0.2000 0.2500 0.2000 0.1667X = 1.2000 0.6000 0.6000X1 = 3.0000 -6.6000 6.6000N = 1N1 = 1Na = 1.3
15、533e+003(6)A=1,4,9;16,25,36;49,64,81B=sqrtm(A)C=sqrt(A) %sqrtm函数是以矩阵为单位进行计算,sqrt函数是以矩阵中的元素进行计算A = 1 4 9 16 25 36 49 64 81B = 0.6344 + 1.3620i 0.3688 + 0.7235i 0.7983 - 0.4388i 1.4489 + 1.1717i 2.7697 + 0.6224i 3.2141 - 0.3775i 4.3578 - 1.6237i 5.7110 - 0.8625i 7.7767 + 0.5231iC = 1 2 3 4 5 6 7 8 9实验
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 理学 MATLAB 卫国 版本

链接地址:https://www.31ppt.com/p-4543620.html