Skip to content

Instantly share code, notes, and snippets.

@ArnyminerZ
Last active February 14, 2022 12:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ArnyminerZ/49e815ca3d8e5c07008317bd459808d9 to your computer and use it in GitHub Desktop.
Save ArnyminerZ/49e815ca3d8e5c07008317bd459808d9 to your computer and use it in GitHub Desktop.
% Dibuja el gradiente de la función z = sen x sen y en el rectángulo
% [−2,2]×[−0.4,1] dividiendo el dominio en cuadrados de lado 0.2. ¿Se
% observa algún punto crítico? ¿De qué tipo?
a = -6; b = 6; % Intervalo
m = 10/0.2; % Número de subintervalos
h = 0.2; % (b-a)/m; % Paso
x = a:h:b; % Partición
a = -4; b = 4; % Intervalo
m = 10/0.2; % Número de subintervalos
h = 0.2; % (b-a)/m; % Paso
y = a:h:b; % Partición
% Calculamos la malla
[X,Y]=meshgrid(x,y);
% Debemos obtener las derivadas parciales de Z sobre x e y manualmente
Zx=sin(Y).*cos(X);
Zy=sin(X).*cos(Y);
% Representamos el gradiente
quiver(X,Y,Zx,Zy);
title('Gradiente de z=xy');
axis equal tight
grid
Ejercicio4_3
% Hacemos que se mantenga la gráfica del gradiente
hold on
% Computamos Z
Z=sin(X).*sin(Y);
% Graficamos sobre el gradiente
surf(X,Y,Z);
xlabel('x'), ylabel('y');
view(37.5,30)
hold off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment