Plot3

x, y, z๊ฐ’์ด ์žˆ์„ ๋•Œ ์ด๋ฅผ ๊ทธ๋ ค์ค€๋‹ค.

% Plot3 plot3(x,y,z, 'line specifiers', 'propertyName', property value) line specifiers; linewidth, linecolor etc property; markersize etc

Example 1

t = 0:0.1:6*pi; 
x = sqrt(t).*sin(2*t); 
y = sqrt(t).*cos(2*t); 
z = 0.5*t; plot3(x,y,z, โ€˜kโ€™, โ€˜linewidthโ€™, 1) grid on 
xlabel(โ€˜xโ€™); 
ylabel(โ€˜yโ€™); 
zlabel(โ€˜zโ€™)

Mesh, Surface plots, Contour3

์ง๊ด€์ ์œผ๋กœ ์ƒ๊ฐํ•ด๋ณด์ž.

์–ด๋–ค ํ‰๋ฉด์ด ์žˆ๋‹ค. ๊ทธ๋Ÿฐ๋ฐ ๊ฐ ํฌ์ธํŠธ๋งˆ๋‹ค ๊ฑด๋ฌผ์„ ์„ธ์šธ๊ฑฐ์•ผ.
๊ทธ๋Ÿฐ๋ฐ plot3์ฒ˜๋Ÿผ z๊ฐ’์˜ ๋ฐ์ดํ„ฐ๊ฐ€ ์ฃผ์–ด์ง„ ๊ฒƒ์ด ์•„๋‹ˆ๊ณ 
z = f(x, y) ์ธ ๊ฒฝ์šฐ ์ผ์ผํžˆ x, y๋ฅผ ๋Œ€์ž…ํ•ด์„œ
z๊ฐ’์„ ๋งŒ๋“œ๋Š” ์ง“์„ ํ•˜๊ธฐ๋Š” ๊ท€์ฐฎ๋‹ค.

๊ทธ๋ž˜์„œ meshgrid ๋ผ๋Š” ์ฒด๋ฅผ ๋งŒ๋“œ๋Š” ํ•จ์ˆ˜๋ฅผ ๋งŒ๋“ค์–ด๋ฒ„๋ฆฌ๊ณ ,
์ž…๋ ฅํ•˜๋ฉด ํ–‰๋ ฌ์˜ ํ˜•ํƒœ๋กœ ๋ฐ”๋กœ ๋งŒ๋“ค์–ด์ค€๋‹ค!

์šฐ๋ฆฌ๊ฐ€ ํ• ์ผ์€ ํ•จ์ˆ˜ f์— ์ด ๊ฐ’์„ ์—ฐ์‚ฐ๋งŒ ์‹œ์ผœ์ฃผ๋ฉด ๋œ๋‹ค.

% Meshgrid [X, Y] = meshgrid(x,y) X, Y๋Š” ํ–‰๋ ฌ๊ฐ’

์ด ํ–‰๋ ฌ์„ ํ†ตํ•ด ๋‚˜์˜จ ๊ฐ’์„ ํ–‰๋ ฌ Z๋กœ ๋ฐ›๋Š”๋‹ค๋ฉด,

% Mesh mesh(X,Y,Z)

ํ•  ๊ฒฝ์šฐ ์ด ๊ฒฉ์žํ™”ํ•œ ๊ฐ’์— ๋Œ€ํ•œ ๊ทธ๋ž˜ํ”„๊ฐ€ ๊ทธ๋ ค์ง„๋‹ค.

์ผ์ •ํ•œ z๊ฐ’์— ๋”ฐ๋ผ ๊ทธ๋ž˜ํ”„๋ฅผ ์ž๋ฅธ ์œค๊ณฝ์„ ๋งŒ ๋‚˜ํƒ€๋‚ด๊ณ  ์‹ถ์œผ๋ฉด
contour3 ํ•จ์ˆ˜๋ฅผ ์‚ฌ์šฉํ•˜๋ฉด ๋œ๋‹ค.
์ด๋ฆ„์—์„œ ์•Œ ์ˆ˜ ์žˆ๋“ฏ์ด ๋“ฑ๊ณ ์„ ์„ ๊ทธ๋ ค์ค€๋‹ค.

% Contour3 contour3(X,Y,Z)

Example 2

๋‹ค์Œ์„ Mesh grid๋กœ ๋งŒ๋“ค์–ด๋ผ.

x = -1:0.1:3; 
y = 1:0.1:4; 
[๐•,Y] = meshgrid(x,y)  
 
Z = X.*Y.^2 ./ (X.^2 + Y.^2)
x =
 
    -1     0     1     2     3
    -1     0     1     2     3
    -1     0     1     2     3
    -1     0     1     2     3
 
 
y =
 
     1     1     1     1     1
     2     2     2     2     2
     3     3     3     3     3
     4     4     4     4     4
 
 
z =
 
   -0.5000         0    0.5000    0.4000    0.3000
   -0.8000         0    0.8000    1.0000    0.9231
   -0.9000         0    0.9000    1.3846    1.5000
   -0.9412         0    0.9412    1.6000    1.9200

Mesh

`mesh(X, Y, Z)```

meshc(X, Y, Z)

surface

surf(X, Y, Z)

contour3

contour3(X, Y, Z)