filmov
tv
Matlab - Plot Parametric Curves and Surfaces
Показать описание
Thanks for watching
CODE:
%%-----------parametric functions--------
%-------'[FX (S, T), FY (S, T), FZ (S, T)]'----------
%
%FX = @(t) sin(t).*(exp(cos(t)-2*cos(4*t)-(sin(t/12)).^5))
%FY = @(t) cos(t).*(exp(cos(t)-2*cos(4*t)-(sin(t/12)).^5))
%FZ = @(t) (t.^2).*exp(-0.05*t);
%%
% ezplot3(FX,FY,FZ,[0,100],10000)
%---------------------------------------------------
% fx = @(s,t) 2*cos (s) .* cos (t);
% fy = @(s,t) 3*sin (s) .* cos (t);
% fz = @(s,t) sin (t);
% ezsurf (fx, fy, fz, [-pi, pi, -pi/2, pi/2],20);
% axis equal;
% xlabel('x')
% ylabel('y')
% zlabel('z')
%% -------------------------------------------------------
FX=@(t,s) 4*cos(3*t).*cos(s)
FY=@(t,s) 2*sin(2*s)
FZ=@(t,s) sin(s)
%
[T,S]=meshgrid(-pi:0.1:pi);
x=FX(T,S);
y=FY(T,S);
z=FZ(T,S);
%
% surf(x,y,z)
%shading interp
%---------------------------------------------------------
ezsurf(FX,FY,FZ,[-pi,pi,-pi,pi],60)
hold on
surfnorm(x,y,z);
axis equal;
title('parametric surface')
xlabel('x')
ylabel('y')
zlabel('z')
CODE:
%%-----------parametric functions--------
%-------'[FX (S, T), FY (S, T), FZ (S, T)]'----------
%
%FX = @(t) sin(t).*(exp(cos(t)-2*cos(4*t)-(sin(t/12)).^5))
%FY = @(t) cos(t).*(exp(cos(t)-2*cos(4*t)-(sin(t/12)).^5))
%FZ = @(t) (t.^2).*exp(-0.05*t);
%%
% ezplot3(FX,FY,FZ,[0,100],10000)
%---------------------------------------------------
% fx = @(s,t) 2*cos (s) .* cos (t);
% fy = @(s,t) 3*sin (s) .* cos (t);
% fz = @(s,t) sin (t);
% ezsurf (fx, fy, fz, [-pi, pi, -pi/2, pi/2],20);
% axis equal;
% xlabel('x')
% ylabel('y')
% zlabel('z')
%% -------------------------------------------------------
FX=@(t,s) 4*cos(3*t).*cos(s)
FY=@(t,s) 2*sin(2*s)
FZ=@(t,s) sin(s)
%
[T,S]=meshgrid(-pi:0.1:pi);
x=FX(T,S);
y=FY(T,S);
z=FZ(T,S);
%
% surf(x,y,z)
%shading interp
%---------------------------------------------------------
ezsurf(FX,FY,FZ,[-pi,pi,-pi,pi],60)
hold on
surfnorm(x,y,z);
axis equal;
title('parametric surface')
xlabel('x')
ylabel('y')
zlabel('z')