Critical points of level curves

14 visualizaciones (últimos 30 días)
Lee
Lee el 19 de Mzo. de 2024
Editada: John D'Errico el 19 de Mzo. de 2024
I'm struggling on doing the below stpes:
1. Use the level curves to predict the location of the critical points of 𝑓 and whether 𝑓 has a
saddle point or a local maximum or minimum at each critical point. Explain your
reasoning.
2. Estimate the local maximum and minimum values and saddle point(s) of the function
and indicate these critical points.
This is what i have done:
% Define the function
f = @(x,y) sin(x) + sin(y) + cos(x+y);
% Create grid for range of x and y values
[X, Y] = meshgrid(0:0.1:1/4*pi, 0:0.1:1/4*pi);
% Compute function values at each point in the grid
Z = f(X, Y);
% Plot graph
subplot(1, 2, 1);
surf(X,Y,Z);
xlabel('x');
ylabel('y');
zlabel('f(x, y)');
grid off; % Turn off gridlines
% Plot level curves
subplot(1, 2, 2);
contour(X, Y, Z, 30);
xlabel('x');
ylabel('y');

Respuestas (1)

John D'Errico
John D'Errico el 19 de Mzo. de 2024
Editada: John D'Errico el 19 de Mzo. de 2024
But what question about MATLAB are you asking? You have plotted the surface. and the level curves. And your code was correct to do that.
You were asked to interpret those cuves, to understand what was generated. That is a completely different thing, purely about mathematics.
f = @(x,y) sin(x) + sin(y) + cos(x+y);
% Create grid for range of x and y values
[X, Y] = meshgrid(0:0.1:1/4*pi, 0:0.1:1/4*pi);
% Compute function values at each point in the grid
Z = f(X, Y);
% Plot graph
subplot(1, 2, 1);
surf(X,Y,Z);
xlabel('x');
ylabel('y');
zlabel('f(x, y)');
grid off; % Turn off gridlines
% Plot level curves
subplot(1, 2, 2);
contour(X, Y, Z, 30);
xlabel('x');
ylabel('y');
Is there some place where you see a characteristic shape of those level curves around a maximum? What would the shape of the level curves be near a maximum or minimum?
I would suggest that you did not look far enough out. Your meshgrid was generated over too small of a region. If, instead, you pushed it out to look from 0 to 2*pi, do you now see minima? Maxima? Saddle points?
figure
f = @(x,y) sin(x) + sin(y) + cos(x+y);
% Create grid for range of x and y values
[X, Y] = meshgrid(linspace(0,2*pi));
% Compute function values at each point in the grid
Z = f(X, Y);
% Plot graph
subplot(1, 2, 1);
surf(X,Y,Z);
xlabel('x');
ylabel('y');
zlabel('f(x, y)');
grid off; % Turn off gridlines
% Plot level curves
subplot(1, 2, 2);
contour(X, Y, Z, 30);
xlabel('x');
ylabel('y');
At this point, YOU need to do the thinking.
What is the characteristic shape of the contours around a min or max?
What is the characteristic shape of contour lines near a saddle point?
I won't answer those questions, as they are purely about mathematics, but also as this is the entire point of the assignment.

Categorías

Más información sobre Surface and Mesh Plots en Help Center y File Exchange.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by