- 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
您可能关注的文档
最近下载
- 监理人员的个人工作总结.docx VIP
- 顶管工作井(D=6500)计算书.docx VIP
- 科雷傲驱使用手册.pdf VIP
- 人教版一年级下册数学全册单元教材分析.doc
- 八篇2025年度民主生活会个人“五个方面”对照检查发言材料.docx VIP
- 专题17.阅读理解CD篇专练(新高考地区专用)-2022届新高考英语基础记忆及题型解题技巧(含答案解析).docx VIP
- 义煤集团宜阳义络煤业有限责任公司提升运输系统改造项目环境影响报告书.doc VIP
- 工程拆除安全责任保证书.docx VIP
- 亚洲象人工辅助育幼技术规范.docx VIP
- 2023年青岛远洋船员职业学院单招英语考试题库及答案解析.docx VIP
原创力文档

文档评论(0)