东南大学205短学期MATLAB作业1.docVIP

  • 29
  • 0
  • 约11.33万字
  • 约 15页
  • 2017-01-02 发布于河南
  • 举报
Matlab Worksheet 1 Part A 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 repeat the expression, editing it to show the effect of using a semicolon after the 10, namely x=10; Answers: x=10 x = 10 x=10; Confirm whether the following names of variables are acceptable: Velocity Yes Velocity1 Yes Velocity.1 No Velocity_1 Yes Velocity-01 No velocityONE Yes 1velocity No Assign two scalar variables x and y values x=1.5, y=2.3, then construct Matlab expressions for the following: a) b) c) Answers:10.2138,8.7566,0.0232,-3.7360 Assign two variables with complex values u=2+3j and v=4+10j and then construct expression for: b) c) d) Answers: a)0.3276 - 0.0690i b) -22.0000 +34.0000i c) 1.5000 - 1.0000i d) 6.1421e+008 +1.5355e+009i Use the colon operator : to assign numerical values between 0 and 1 to vector array variable a in steps of 0.1. Answer: a=colon(0,0.1,1) Use linspace function to assign 20 values to vector variable y between 20 and 30. Answer: linspace(20,30,20) Assign 20 values to a variable h increasing logarithmically between 10 and 1000. Next, use the colon operator to assign the first 10 elements of h to a variable p. Answers: h=linspace(10,1000,20); p=h(1:10) 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 -1.7 1.8 1.9] sum=z(2)+z(4)+z(6) 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 . Add x and y, b) subtract 10x from 5y. Answers: x=10:-1:-10 y=20:-2:-20 add=x+y sub=5*y-10*x Use the size, length, who and whos commands to establish the size and lengt

文档评论(0)

1亿VIP精品文档

相关文档