Last active
February 14, 2022 12:05
-
-
Save ArnyminerZ/49e815ca3d8e5c07008317bd459808d9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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