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

加入VIP,免费下载
 

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

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

下载须知

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

版权提示 | 免责声明

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

东南大学Matlab作业1.docx

1、东南大学Matlab作业1Matlab Worksheet 1Part A1. Get into Matlab: Use the diary command to record your activity in to a file: diary mydiary01.doc before you start your work. (And diary off to switch off your diary when you finish your work.)At the Command Window assign a value x=10, then use the Up Key to re

2、peat the expression, editing it to show the effect of using a semicolon after the 10, namely x=10;Answers: x=10x = 10 x=10;2. Confirm whether the following names of variables are acceptable:a) Velocity Yes Nob) Velocity1 Yes No c) Velocity.1 Yes Nod) Velocity_1 Yes Noe) Velocity-01 Yes Nof) velocity

3、ONE Yes Nog) 1velocity Yes NoAnswers: (1)legal variable names : a) Velocityb) Velocity1d) Velocity_1f) velocityONE(2) illegal variable names: c) Velocity.1e) Velocity-01g) 1velocity 3. Assign two scalar variables x and y values x=1.5, y=2.3, then construct Matlab expressions for the following:a) b)

4、c) d) Answers: the result of the Command Window is: x=1.5;y=2.3 ;z1=5*x3*y/(x+y)z2=(x7*y0.5)(2/3)z3=(x(1/6)/(log10(x5-1)+1)*exp(-2*y)z4=sin(2*pi*x-y)+exp(x).*cos(2*pi*x)z1 = 10.2138z2 = 8.7566z3 = 0.0232z4 = -3.73604. Assign two variables with complex values u=2+3j and v=4+10j and then construct exp

5、ression for:a) b) c) d) Answers: the result of the Command Window is: u=2+3j;v=4+10j;z1=u/vz2=u*v+2jz3=u/2jz4=v*exp(-j*2*pi*u)z1 = 0.3276 - 0.0690iz2 = -22.0000 +34.0000iz3 = 1.5000 - 1.0000iz4 = 6.1421e+08 + 1.5355e+09i5. Use the colon operator : to assign numerical values between 0 and 1 to vector

6、 array variable a in steps of 0.1.Answer: the result of the Command Window is: V=0:0.1:1V = Columns 1 through 10 0 0.1000 0.2000 0.3000 0.4000 0.5000 0.6000 0.7000 0.8000 0.9000 Column 11 1.00006. Use linspace function to assign 20 values to vector variable y between 20 and 30.Answer: the result of

7、the Command Window is: V=linspace(20,30,20)V = Columns 1 through 10 20.0000 20.5263 21.0526 21.5789 22.1053 22.6316 23.1579 23.6842 24.2105 24.7368 Columns 11 through 20 25.2632 25.7895 26.3158 26.8421 27.3684 27.8947 28.4211 28.9474 29.4737 30.00007. Assign 20 values to a variable h increasing loga

8、rithmically between 10 and 1000.Next, use the colon operator to assign the first 10 elements of h to a variable p.Answers: v=logspace(1,3,20)v = 1.0e+03 * Columns 1 through 10 0.0100 0.0127 0.0162 0.0207 0.0264 0.0336 0.0428 0.0546 0.0695 0.0886 Columns 11 through 200.1129 0.1438 0.1833 0.2336 0.297

9、6 0.3793 0.4833 0.6158 0.7848 1.0000 p=v(1:10)p =10.0000 12.7427 16.2378 20.6914 26.3665 33.5982 42.8133 54.5559 69.5193 88.5867 8. Create 6 element row vector z with values 1.0 1.2 1.6 -1.7 1.8 1.9, then construct an expression for the sum of the 2nd 4th and 6th elements of z.Answers: z=1.0 1.2 1.6

10、 -1.7 1.8 1.9x=z(2)+z(4)+z(6)z = 1.0000 1.2000 1.6000 -1.7000 1.8000 1.9000x = 1.40009. Use the colon operator to create a vector array x between 10 and -10in steps of -1, and second, an array vector y between 20 and -20 in steps -2 .a) Add x and y, b) subtract 10x from 5y.Answers: x=10:-1:-10 y=20:

11、-2:-20x = Columns 1 through 17 10 9 8 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 Columns 18 through 21 -7 -8 -9 -10y = Columns 1 through 17 20 18 16 14 12 10 8 6 4 2 0 -2 -4 -6 -8 -10 -12 Columns 18 through 21 -14 -16 -18 -20 x+yans = Columns 1 through 17 30 27 24 21 18 15 12 9 6 3 0 -3 -6 -9 -12 -15 -18 Col

12、umns 18 through 21 -21 -24 -27 -30 5*y-10*xans = Columns 1 through 17 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 Columns 18 through 21 0 0 0 010. Use the size, length, who and whos commands to establish the size and length of x and y from Question 9, and use transpose operator to convert vector x from Questi

13、on 9.Answers: size(x) length(x)ans = 1 21ans = 21 whoYour variables are:ans x y whos Name Size Bytes Class Attributes ans 1x1 8 double x 1x21 168 double y 1x21 168 double z=xz = 10 9 8 7 6 5 4 3 2 1 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -1011. Show that if w= 2i 3i 3+i the . operator creates the transpose. W

14、hat effect does the operator applied to w have on its own?Answer: w= 2i 3i 3+iw = 0 + 2.0000i 0 + 3.0000i 3.0000 + 1.0000i x=wx = 0 - 2.0000i 0 - 3.0000i 3.0000 - 1.0000i y=w.y = 0 + 2.0000i 0 + 3.0000i 3.0000 + 1.0000i12. Use the ones function to create a 4 by 6 array of 1s. Considering just the sh

15、ape of the resulting array, what do the expression ones(3), ones(5) and ones(7) all have in common?Answer: v=ones(4,6)v = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ones(3)ans = 1 1 1 1 1 1 1 1 1 ones(5)ans = 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1Ones(n)是n阶全为1的方阵13. Create using the

16、rand function a 5 by 4 random matrix and assign it to matrix array variable A and observe carefully what A(:,3) A(1:2) and A(3,2 4) mean.Answer: A=rand(5,4)A = 0.8147 0.0975 0.1576 0.1419 0.9058 0.2785 0.9706 0.4218 0.1270 0.5469 0.9572 0.9157 0.9134 0.9575 0.4854 0.7922 0.6324 0.9649 0.8003 0.9595

17、A(:,3) ans = 0.1576 0.9706 0.9572 0.4854 0.8003 A(1:2) ans =0.8147 0.9058 A(3,2 4) ans = 0.5469 0.915714. Using array subscripts, create an expression for the sum of the element in the top right-hand-corner of A and the bottom left-hand-corner of A. Also assign the 2nd column of A to a column vector

18、 b, and assign the 3rd row of A to a row vector d.Answer: A=rand(5,4)A = 0.7513 0.9593 0.8407 0.3500 0.2551 0.5472 0.2543 0.1966 0.5060 0.1386 0.8143 0.2511 0.6991 0.1493 0.2435 0.6160 0.8909 0.2575 0.9293 0.4733 x=A(1,4)+A(4,1)x =1.0491 b=A(:,2)b = 0.9593 0.5472 0.1386 0.1493 0.2575 d=A(3,:)d = 0.5

19、060 0.1386 0.8143 0.2511 diary off to switch off your diary now.15. Using the colon operator, assign a row vector array t, values between 0 and 10 in steps of 0.01. Use the ; operator to prevent displaying the information. Obtain the term-by-term values of functions:a) b) c) Answers: (1)home_work_1_

20、A_15.mt=0:0.01:10;z1=exp(-0.05*t)z2=z1.*sin(pi*t)z3=z2.*cos(2*pi*t)(2)result home_work_1_A_15z1 = Columns 1 through 10 1.0000 0.9995 0.9990 0.9985 0.9980 0.9975 0.9970 0.9965 0.9960 0.9955 Columns 11 through 20 0.9950 0.9945 0.9940 0.9935 0.9930 0.9925 0.9920 0.9915 0.9910 0.9905 Columns 21 through

21、30 0.9900 0.9896 0.9891 0.9886 0.9881 0.9876 0.9871 0.9866 0.9861 0.9856 Columns 31 through 40 0.9851 0.9846 0.9841 0.9836 0.9831 0.9827 0.9822 0.9817 0.9812 0.9807 Columns 41 through 50 0.9802 0.9797 0.9792 0.9787 0.9782 0.9778 0.9773 0.9768 0.9763 0.9758 Columns 51 through 60 0.9753 0.9748 0.9743

22、0.9738 0.9734 0.9729 0.9724 0.9719 0.9714 0.9709 Columns 61 through 70 0.9704 0.9700 0.9695 0.9690 0.9685 0.9680 0.9675 0.9671 0.9666 0.9661 Columns 71 through 80 0.9656 0.9651 0.9646 0.9642 0.9637 0.9632 0.9627 0.9622 0.9618 0.9613 Columns 81 through 90 0.9608 0.9603 0.9598 0.9593 0.9589 0.9584 0.9

23、579 0.9574 0.9570 0.9565 Columns 91 through 100 0.9560 0.9555 0.9550 0.9546 0.9541 0.9536 0.9531 0.9527 0.9522 0.9517 Columns 101 through 110 0.9512 0.9508 0.9503 0.9498 0.9493 0.9489 0.9484 0.9479 0.9474 0.9470 Columns 111 through 120 0.9465 0.9460 0.9455 0.9451 0.9446 0.9441 0.9436 0.9432 0.9427 0

24、.9422 Columns 121 through 130 0.9418 0.9413 0.9408 0.9404 0.9399 0.9394 0.9389 0.9385 0.9380 0.9375 Columns 131 through 140 0.9371 0.9366 0.9361 0.9357 0.9352 0.9347 0.9343 0.9338 0.9333 0.9329 Columns 141 through 150 0.9324 0.9319 0.9315 0.9310 0.9305 0.9301 0.9296 0.9291 0.9287 0.9282 Columns 151

25、through 160 0.9277 0.9273 0.9268 0.9264 0.9259 0.9254 0.9250 0.9245 0.9240 0.9236 Columns 161 through 170 0.9231 0.9227 0.9222 0.9217 0.9213 0.9208 0.9204 0.9199 0.9194 0.9190 Columns 171 through 180 0.9185 0.9181 0.9176 0.9171 0.9167 0.9162 0.9158 0.9153 0.9148 0.9144 Columns 181 through 190 0.9139

26、 0.9135 0.9130 0.9126 0.9121 0.9116 0.9112 0.9107 0.9103 0.9098 Columns 191 through 200 0.9094 0.9089 0.9085 0.9080 0.9076 0.9071 0.9066 0.9062 0.9057 0.9053 Columns 201 through 210 0.9048 0.9044 0.9039 0.9035 0.9030 0.9026 0.9021 0.9017 0.9012 0.9008 Columns 211 through 220 0.9003 0.8999 0.8994 0.8

27、990 0.8985 0.8981 0.8976 0.8972 0.8967 0.8963 Columns 221 through 230 0.8958 0.8954 0.8949 0.8945 0.8940 0.8936 0.8932 0.8927 0.8923 0.8918 Columns 231 through 240 0.8914 0.8909 0.8905 0.8900 0.8896 0.8891 0.8887 0.8883 0.8878 0.8874 Columns 241 through 250 0.8869 0.8865 0.8860 0.8856 0.8851 0.8847

28、0.8843 0.8838 0.8834 0.8829 Columns 251 through 260 0.8825 0.8821 0.8816 0.8812 0.8807 0.8803 0.8799 0.8794 0.8790 0.8785 Columns 261 through 270 0.8781 0.8777 0.8772 0.8768 0.8763 0.8759 0.8755 0.8750 0.8746 0.8742 Columns 271 through 280 0.8737 0.8733 0.8728 0.8724 0.8720 0.8715 0.8711 0.8707 0.87

29、02 0.8698 Columns 281 through 290 0.8694 0.8689 0.8685 0.8681 0.8676 0.8672 0.8668 0.8663 0.8659 0.8655 Columns 291 through 300 0.8650 0.8646 0.8642 0.8637 0.8633 0.8629 0.8624 0.8620 0.8616 0.8611 Columns 301 through 310 0.8607 0.8603 0.8598 0.8594 0.8590 0.8586 0.8581 0.8577 0.8573 0.8568 Columns

30、311 through 320 0.8564 0.8560 0.8556 0.8551 0.8547 0.8543 0.8538 0.8534 0.8530 0.8526 Columns 321 through 330 0.8521 0.8517 0.8513 0.8509 0.8504 0.8500 0.8496 0.8492 0.8487 0.8483 Columns 331 through 340 0.8479 0.8475 0.8470 0.8466 0.8462 0.8458 0.8454 0.8449 0.8445 0.8441 Columns 341 through 350 0.8437 0.8432 0.8428 0.8424 0.8420 0.8416 0.8411 0.8407 0.8403 0.8399 Columns 351 through 360 0.8395 0.8390 0.8386 0.8382 0.8378 0.8374 0.8369 0.8365 0.8

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

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