Question: 2 . 2 Identify which name in each of the following pairs is a legitimate MATLAB variable name: fred fred! book _ 1 book -
Identify which name in each of the following pairs is a legitimate MATLAB
variable name:
fred fred!
book book
ndplace SecondPlace
# No
vel vel
tan while
Test your answers by using isvarnamefor example,
isvarname fred
Remember, isvarname returns a if the name is valid and a 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
Create MATLAB code to perform the following calculations:
#
Hint: A square root is the same thing as a power.
#
# #
Check your code by entering it into MATLAB and performing the
calculations on your scientific calculator.
As you answer the following questions, consider the shapes shown in
Figure P
a The area of a circle is pr Defi ne r as then find the area of a circle,
using MATLAB
b The surface area of a sphere is pr Find the surface area of a sphere
with a radius of ft
c The volume of a sphere is pr Find the volume of a sphere with a
radius of ft
As you answer the following questions, consider the shape shown in
Figure P
a The area of a square is the edge length squared A edge Defi ne
the edge length as then find the area of a square, using MATLAB
b The surface area of a cube is times the edge length squared
SA edge Find the surface area of a cube with edge length
c The volume of a cube is the edge length cubed V edge Find the
volume of a cube with edge length
Consider the barbell shown in Figure P
r
Figure Pa
e
e
Figure Pac
Figure P
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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
