MuPAD® notebooks are not recommended. 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.
[px, py, pz],
[fx, fy, fz],
a = amin .. amax>,
pz], [fx, fy,
fz], angle) creates a camera at the
pz] pointing towards the focal point
fy, fz]. The
opening angle of its lense is given by
When creating a 3D scene, an “automatic camera”
is used. Its location can be controlled by the attribute
but there are now further means of manipulating its parameters.
If the automatic camera does not suffice for your purposes,
you may define your own camera by
Inserting such a camera object in your scene (for example, just by
passing the camera as an argument to the
plot command), the automatic camera is
switched off and the new camera determines the view.
A camera of type
plot::Camera allows to set
all parameters determining the view and its perspective. Further,
all parameters can be animated such that an animated “flight”
through a 3D scene can be realized.
The optical axis is given by the vector
Together with the opening angle of the zoom lense (
these parameters determine the view of the scene.
FocalPoint vector can be replaced by
any other point on the optical axes without changing the view. (
not coincide, though.)
By default, the z-direction
in 3-space corresponds to the vertical direction of the final picture.
If this is not desired, the camera can be rotated around its optical
axes using the attribute
Depending on the distance of the camera to the graphical scene and the opening angle of the lense, the scene may fill only a small portion of the viewing area if the camera is too far away. If the camera is too close, only some parts of the scene may be visible
Just as for a real camera, you will have to move closer to or
farther away from the scene to make it fill the drawing area as desired.
Alternatively, you may keep the camera position fixed and use the
zoom lense by choosing an appropriate
As in real life, you have to find appropriate parameters experimentally by looking at the picture and changing the parameters interactively.
Alternatively, you may define the camera with the attribute
This has the same effect as positioning the camera at a large distance
from the scene using a powerful tele lense.
In this case, the camera ignores the
ViewingAngle and the
3-space. It is moved along the optical axis
infinity and chooses an infinitesimal small viewing angle such that
the scene fills the drawing area optimally.
Several cameras can be present simultaneously in a graphical
scene. The first camera specified in the
plot command determines the views.
One may switch between the cameras by clicking on the corresponding camera in the interactive “object browser” of the MuPAD® graphics tool (see section Viewer, Browser, and Inspector: Interactive Manipulation of this document).
You may place your own light
sources in the scene. When specifying the attribute
the definition of the lights, they are attached to the camera and
move automatically, when the camera is moved.
|the focal point of a camera|
|the focal point of a camera, x-coordinate|
|the focal point of a camera, y-coordinate|
|the focal point of a camera, z-coordinate|
|the number of frames in an animation|
|keep the UpVector constant when moving the camera?|
|the name of a plot object (for browser and legend)|
|parallel projection without perspective distortion|
|end value of the animation parameter|
|name of the animation parameter|
|initial value of the animation parameter|
|range of the animation parameter|
|positions of cameras, lights, and text objects|
|x-positions of cameras, lights, and text objects|
|y-positions of cameras, lights, and text objects|
|z-positions of cameras, lights, and text objects|
|end time of the animation|
|start time of the animation|
|the real time span of an animation|
|“up direction” of a camera||[|
|opening angle of the camera lense|
We use our own camera to view the 3D graph of a function:
f := plot::Function3d(sin(x) + y^3 + 2*exp(-3*x^2 - 20*y^2), x = -PI..PI, y = -1 .. 1, Submesh = [2, 2]): camera := plot::Camera([-12, -4, 14], [0, 0, 0], PI/7): plot(f, camera):
We move the camera to another position:
camera::Position := [7, -5, 6]: plot(f, camera):
We turn the camera towards the central peak and zoom in by decreasing the openening angle of the zoom lense:
camera::FocalPoint := [0, 0, 1]: camera::ViewingAngle := PI/20: plot(f, camera):
We create an animated camera and fly through the scene:
camera := plot::Camera([-15 + 3*a, 4 - a, 3 + (a - 4)^2], [0, 0, 1.5], PI/6, a = 0..8, Frames = 100, TimeRange = 0..20): plot(f, camera):
delete f, camera:
Coordinates of the camera position: numerical real values or arithmetical expressions of
the animation parameter
Coordinates of the the focal point: numerical real values or arithmetical expressions of
the animation parameter
The opening angle of the lense in radians: a numerical real
value or an arithmetical
expression of the animation parameter
Animation parameter, specified as