%% Create Surface Plot With Light Object
% Create three matrices of the same size. Then plot them as a surface with highlights from a MATLAB® light object. The surface uses Z for height and both Z and the light object for color. The function returns an array containing a surface object and a lighting object. Assign it to the variable sl.

[X,Y] = meshgrid(1:0.5:10,1:20);
Z = sin(X) + cos(Y);
sl = surfl(X,Y,Z,'light');

%
% Index into sl to access and modify properties of the surface object and the light object after they are created. The surface plot is accessible as sl(1) and the light object as sl(2). For example, change the color of the light by setting the Color property of the light object.

sl(2).Color = 'r';

% Copyright 2019 The MathWorks, Inc.