This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English verison of the page.

Note: This page has been translated by MathWorks. Please click here
To view all translated materals including this page, select Japan from the country navigator on the bottom of this page.


Opening angle of the light cone of a spot light

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.

Value Summary

MandatoryReal-valued expression (interpreted in radians)

Graphics Primitives

ObjectsSpotAngle Default Values


SpotAngle sets the opening angle of the light cone of a spot light in radians, and defines the opening angle of the light cone emitted by spot lights of type plot::SpotLight.

The values for SpotAngle have to be given in radians. Reasonable value lie between 0 and π.

SpotAngle can be animated.


Example 1

When creating a spot light, the third argument is the SpotAngle:

spotlight := plot::SpotLight([0, 0, 1], [0, 0, 0], a*PI, 1, 
                             a = 0..0.4, LightColor = RGB::White):

We illuminate the x-y plane by the animated spot light and some ambient light. The spot light is visualized by a cone:

ambientlight := plot::AmbientLight(0.2):
s := plot::Surface([x, y, 0], x = -1..1, y = -1..1, 
                   Submesh = [2, 2], Color = RGB::White, 
                   FillColorType = Flat):
c := plot::Cone(0, [0, 0, 1], 
                0.6*tan(a*PI/2), [0, 0, 1 - 0.6],
                a = 0..0.4, Color = RGB::Orange.[0.5]): 
plot(s, c, spotlight, ambientlight,
     CameraDirection = [-9, -18, 12])

delete spotlight, ambientlight, s, c:
Was this topic helpful?