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.
a = amin .. amax>,
plot::AmbientLight(intensity) generates undirected
ambient light of the given intensity.
Each 3D scene is illuminated by several light sources that are
set automatically and cannot be controlled by the user. Cf. the help
If at least one user defined light source is inserted into the
scene (e.g., by simply passing the light objects as input parameters
the automatic lights are switched off and the user defined lights
are used to illuminate the scene.
While directed lights such as
create shading effects that add depth to the picture, a certain amount
of undirected ambient light is usually needed.
plot::AmbientLight(intensity) creates ambient
light whose intensity is given by the parameter
When the intensity is 1,
the ambient light dominates all other light sources.
By default, white light is created. Other colours can be chosen
by the attribute
It does not make sense to have more than one ambient light object in a scene.
|the number of frames in an animation|
|the color of light|
|intensity of light|
|the name of a plot object (for browser and legend)|
|end value of the animation parameter|
|name of the animation parameter|
|initial value of the animation parameter|
|range of the animation parameter|
|end time of the animation|
|start time of the animation|
|the real time span of an animation|
We create a 3D function graph in flat white and use ambient white light to illuminate it:
f := plot::Function3d(sin(x + y) + cos(x - y), x = -PI..PI, y = -PI..PI, FillColorType = Flat, Color = RGB::White): ambientlight := plot::AmbientLight(0.7): plot(f, ambientlight):
We create another ambient light with animated intensity:
ambientlight := plot::AmbientLight(a, a = 0..1): plot(f, ambientlight)
We add directed yellow light to the scene and study the mixture between the “sunlight” and an increasing amount of ambient light. When the ambient light is at full intensity, it dominates the directed light completely:
sunlight := plot::DistantLight([0, 0, 0], [5, 1, -3], 1, LightColor = RGB::Yellow): plot(f, ambientlight, sunlight)
delete f, ambientlight, sunlight:
The intensity of the light: a numerical value between 0 and 1 or
expression of the animation parameter
Animation parameter, specified as