% 3D grafika
%%
t=0:pi/50:10*pi;
plot3(sin(t),cos(t),t)
title('Helix'), xlabel('sin(t)'), ylabel('cos(t)'), zlabel('t')
%%
x = -8:0.5:8;
y = x;
[X, Y] = meshgrid(x,y);
R = sqrt(X.^2 + Y.^2) + eps;   % distance from the origin (0,0)
Z = sin(R)./R;                 % calculate sin(r)/r
mesh(X,Y,Z)
axis([-8 8 -8 8 min(min(Z)) max(max(Z))])
%%
mesh(Z)
size(Z)
%%
surf(X,Y,Z)
shading flat
%%
shading interp
%%
view(2)
%%
axis equal
%%
view(3)
%%
axis normal
%%
mesh(peaks)
%%
contour(peaks)
%%
contour(peaks, 20)
%%
contour3(peaks, 20)
%%
[x,y,z] = peaks;
%%
contour(x,y,z,20)
axis([-3 3 -3 3 -6 8])
%%
pcolor(peaks)
shading flat
%%
peaks
view(-90,0)
%%
view([-7 -9 7])  % view through (-7 -9 7) to the origin
[az, el] = view  % find the azimuth and elevation 
%%
mesh(peaks(30)+7)     % mesh, shifted up
hold on
%%
pcolor(peaks(30))  % add a pseudocolor plot
hold off
title('Mesh with Hidden On')
%%
hidden off
title('Mesh with Hidden Off')
%%
surfl(peaks)
colormap(gray)
shading interp
%%
surfc(peaks)
%%
meshz(peaks)
%%
[X, Y] = meshgrid([-2:.2:2]);
Z = X.* exp(-X.^2 - Y.^2);
surf(X, Y, Z, gradient(Z))
colormap(hot)
colorbar
%%
P = peaks(40);
C = del2(P);
surf(P, C)
%%
surf(P)
%%
p = peaks;
p(30:40,20:30) = NaN * p(30:40,20:30); mesh(peaks,p)
