Center of objects, rotation center
MuPAD® notebooks will be removed in a future release. Use MATLAB® live scripts instead.
MATLAB live scripts support most MuPAD functionality, though there are some differences. For more information, see Convert MuPAD Notebooks to MATLAB Live Scripts.
Center determines the center of
various objects such a circles, spheres, pie charts etc. In rotation
objects, it refers to the center of rotation.
Depending on the dimension of the object, it is given by a list or vector of 2 or 3 components.
CenterX etc. refer to the x, y, z components
of this vector.
The values of these attributes can be animated.
We create circles around the origin:
c1 := plot::Circle2d(1, [0, 0]): c2 := plot::Circle2d(2, [0, 0]):
The second argument in
plot::Circle2d is the
center. Internally, it is stored as the attribute
can be changed by assigning a new value:
c1::Center := [1, 0]: c2::Center := [-1, 1]: plot(c1, c2):
delete c1, c2:
We create an ellipse with an animated center. A copy of it is rotated around this center:
e1 := plot::Ellipse2d(1, 3, Center = [a, a], a = 0..5): e2 := plot::Rotate2d(e1, Angle = a*PI/2, Center = e1::Center, a = 0..5): plot(e1, e2)
delete e1, e2:
We create a sphere of radius 2 and
change the default center
[0, 0, 0] to
s := plot::Sphere(2): s::Center := [1, 2, 3]: plot(s)