%% Creating the MATLAB logo
% from https://www.mathworks.com/help/matlab/visualize/creating-the-matlab-logo.html
% Copyright (C) 2014  Mathworks Inc.
close all; clear; clc;

%% Create the surface
L = 160*membrane(1,100);

%% Create the figure and axes
f = figure;
ax = axes;

s = surface(L);
s.EdgeColor = 'none';
view(3)

%% Adjust axis limits
ax.XLim = [1 201];
ax.YLim = [1 201];
ax.ZLim = [-53.4 160];

%% Adjust the camera position
ax.CameraPosition = [-145.5 -229.7 283.6];
ax.CameraTarget = [77.4 60.2 63.9];
ax.CameraUpVector = [0 0 1];
ax.CameraViewAngle = 36.7;

%% Adjust the position of the x, y, z axes themselves
ax.Position = [0 0 1 1];
ax.DataAspectRatio = [1 1 .9];

%% Add some light
l1 = light;
l1.Position = [160 400 80];
l1.Style = 'local';
l1.Color = [0 0.8 0.8];
 
l2 = light;
l2.Position = [.5 -1 .4];
l2.Color = [0.8 0.8 0];

%% Change the surface color
s.FaceColor = [0.9 0.2 0.2];

%% Adjust lighting algorithm
s.FaceLighting = 'gouraud';
s.AmbientStrength = 0.3;
s.DiffuseStrength = 0.6; 
s.BackFaceLighting = 'lit';

s.SpecularStrength = 1;
s.SpecularColorReflectance = 1;
s.SpecularExponent = 7;

%% Remove background
axis off
f.Color = 'black';
