Matlab Worksheet 1
Part A
1.
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 v
alue x=10, then use the Up Key ?nbsp;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;
2.
Confirm whether the following names of variables are acceptable:
a)
Velocity
Yes
No
b)
Velocity1
Yes
No
c)
Velocity.1
Yes
No
d)
Velocity_1
Yes
No
e)
Velocity-01
Yes
No
f)
velocityONE
Yes
No
g)
1velocity
Yes
No
3.
Assign two scalar variables x and y values x=1.5, y=2.3, then construct Matlab
expressions for the following:
a)
y
x
y
x
z
?/p>
?/p>
3
5
b)
?
?
3
/
2
7
y
x
z
?/p>
c)
?/p>
?
y
e
x
x
z
2
5
10
6
/
1
1
1
log
?/p>
?/p>
?/p>
?
?/p>
?/p>
?/p>
?/p>
?/p>
?/p>
?/p>
d)
)
2
cos(
)
2
sin(
x
e
y
x
z
x
?/p>
?/p>
?/p>
?/p>
?/p>
Answers: