Main Content

MATLAB 로고 생성

이 예제에서는 MATLAB® 로고를 만들고 표시하는 방법을 보여줍니다.

membrane 명령을 사용하여 로고의 곡면 데이터를 생성합니다.

L = 160*membrane(1,100);

Figure와 좌표축을 만들어 로고를 표시합니다. 그런 다음 membrane 명령의 결과로 얻은 점을 사용하여 로고의 곡면을 만듭니다. 곡면의 선을 끕니다.

f = figure;
ax = axes;

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

Figure contains an axes object. The axes object contains an object of type surface.

좌표축 제한을 조정하여 좌표축이 로고 주변으로 딱 맞도록 만듭니다.

ax.XLim = [1 201];
ax.YLim = [1 201];
ax.ZLim = [-53.4 160];

Figure contains an axes object. The axes object contains an object of type surface.

좌표축의 카메라 속성을 사용하여 로고의 보기를 조정합니다. 카메라 속성은 줌 렌즈가 있는 카메라처럼 3차원 장면 보기를 제어합니다.

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;

Figure contains an axes object. The axes object contains an object of type surface.

좌표축 위치와 x, y, z 종횡비를 변경하여 Figure 창의 남는 공간을 채웁니다.

ax.Position = [0 0 1 1];
ax.DataAspectRatio = [1 1 .9];

Figure contains an axes object. The axes object contains an object of type surface.

조명을 만들어 로고를 비춥니다. 조명 자체는 보이지 않지만 light의 속성을 설정하여 axes의 patch 객체나 surface 객체의 모양을 변경할 수 있습니다.

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];

Figure contains an axes object. The axes object contains an object of type surface.

로고 색을 변경합니다.

s.FaceColor = [0.9 0.2 0.2];

Figure contains an axes object. The axes object contains an object of type surface.

곡면의 조명 속성과 정반사율 속성을 사용하여 조명 효과를 제어합니다.

s.FaceLighting = 'gouraud';
s.AmbientStrength = 0.3;
s.DiffuseStrength = 0.6; 
s.BackFaceLighting = 'lit';

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

Figure contains an axes object. The axes object contains an object of type surface.

축을 끄고 최종 결과를 확인합니다.

axis off
f.Color = 'black';