vert = [0 0 0; 1 0 0;1 1 0; 0 1 0; 0 0 1; 1 0 1; 1 1 1; 0 1 1];
fac = [1 2 6 5; 2 3 7 6; 3 4 8 7; 4 1 5 8; 1 2 3 4; 5 6 7 8];
subplot(2,2,1), title('Flat Lighting')
hp(1) = patch('Vertices',vert,'Faces',fac,...
'FaceVertexCData',hsv(6),'FaceColor','flat',...
light('Position',[2 2 2]), view(30,30)
subplot(2,2,2), title('Gouraud Lighting')
hp(2) = patch('Vertices',vert,'Faces',fac,...
'FaceVertexCData',hsv(6),'FaceColor','flat',...
'FaceLighting','gouraud');
light('Position',[2 2 2]), view(30,30)
subplot(2,2,3), title('Flat Lighting')
hp(3) = patch([1 1 1 1], [0 1 1 0], [0 0 1 1],[1 1 0],...
light('Position',[2 2 2]), view(30,30)
subplot(2,2,4), title('Gouraud Lighting')
hp(4) = patch([1 1 1 1], [0 1 1 0], [0 0 1 1],[1 1 0],...
'FaceLighting','Gouraud');
light('Position',[2 2 2]), view(30,30)
[hp(:).DiffuseStrength] = deal(0.8);