%% prog048 mas graficos clearvars; close all; clc; %% generacion de la grilla Lx = 3*pi; Ly = 3*pi; incx = 0.1*pi; incy = 0.1*pi; %esto genera dos matrices x e y para definir todos los puntos de plano [x,y] = meshgrid(-Lx:incx:Lx,-Ly:incy:Ly); %% funcion caja de huevos a = 0.25; b = 2.00; c = 0.05; %funcion para ello usamos las operaciones de matrices punto a punto fxy = c*(x.^2 + y.^2) - b*cos(a*pi*x).*cos(a*pi*y); %% graficos %superficie simple figure(1) surf(x,y,fxy); title('funcion f(x,y)'); xlabel('x (m)'); ylabel('y (m)'); zlabel('z (m)'); daspect([1,1,1]); grid on; box on; colormap jet; colorbar; %malla simple figure(2) mesh(x,y,fxy); title('funcion f(x,y)'); xlabel('x (m)'); ylabel('y (m)'); zlabel('z (m)'); daspect([1,1,1]); grid on; box on; colormap jet; colorbar; %contorno simple figure(3) NC = 50;%numero de contornos contour(x,y,fxy,50); title('funcion f(x,y)'); xlabel('x (m)'); ylabel('y (m)'); zlabel('z (m)'); daspect([1,1,1]); grid on; box on; colormap jet; colorbar; %contorno 3D figure(4) NC = 50;%numero de contornos contour3(x,y,fxy,50); title('funcion f(x,y)'); xlabel('x (m)'); ylabel('y (m)'); zlabel('z (m)'); daspect([1,1,1]); grid on; box on; colormap jet; colorbar; %curva en el espacio 3D t = 0:0.01*pi:5*pi; xt = 5*cos(3*t)./(t+1); yt = 5*sin(3*t)./(t+1); zt = t; figure(5) plot3(xt,yt,zt); title('curva en el espacio'); xlabel('x (m)'); ylabel('y (m)'); zlabel('z (m)'); daspect([1,1,1]); grid on; box on;