Question: 2 . 2 Identify which name in each of the following pairs is a legitimate MATLAB variable name: fred fred! book _ 1 book -

2.2 Identify which name in each of the following pairs is a legitimate MATLAB
variable name:
fred fred!
book_1 book-1
2ndplace Second_Place
#1 No_1
vel_5 vel.5
tan while
Test your answers by using isvarnamefor example,
isvarname fred
Remember, isvarname returns a 1 if the name is valid and a 0 if it is not.
Although it is possible to reassign a function name as a variable name, doing
so is not a good idea. Use which to check whether the preceding names are
function namesfor example,
which sin
In what case would MATLAB tell you that sin is a variable name, not a
function name?
Scalar Operations and Order of Operations
2.3 Create MATLAB code to perform the following calculations:
52
53
5 # 6
2463(Hint: A square root is the same thing as a 1/2 power.)
96
127 # 532
15 # 3>62224 # 1>5.5
Check your code by entering it into MATLAB and performing the
calculations on your scientific calculator.
2.4 As you answer the following questions, consider the shapes shown in
Figure P2.4.
(a) The area of a circle is pr2. Defi ne r as 5, then find the area of a circle,
using MATLAB.
(b) The surface area of a sphere is 4pr2. Find the surface area of a sphere
with a radius of 10 ft.
(c) The volume of a sphere is 4/3pr3. Find the volume of a sphere with a
radius of 2 ft.
2.5 As you answer the following questions, consider the shape shown in
Figure P2.5.
(a) The area of a square is the edge length squared 1A edge22. Defi ne
the edge length as 5, then find the area of a square, using MATLAB
.
(b) The surface area of a cube is 6 times the edge length squared
1SA 6 edge22. Find the surface area of a cube with edge length 10.
(c) The volume of a cube is the edge length cubed 1V edge32. Find the
volume of a cube with edge length 12.
2.6 Consider the barbell shown in Figure P2.6.
r
Figure P2.4(a)
e
e
Figure P2.5(ac)
Figure P2.6
The geometry of a barbell can
be modeled as two spheres
and a cylindrical rod.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!