How to flot the function f(x,y)=(x^(2)+y^(2)) ℯ^(y^(2)-x^(2))

조회 수: 5 (최근 30일)
Nguyet Nguyen
Nguyet Nguyen 2022년 8월 13일
답변: Walter Roberson 2022년 8월 13일
I used the code:
figure
fsurf(@(x,y)(x.^2+y.^2)* exp(y.^2-x.^2),
but i don't know the range to input. can you guys help me please
  댓글 수: 2
Rik
Rik 2022년 8월 13일
What range of x and y do you want to show? This is a question you need to answer, as it depends on what you want to do.
Nguyet Nguyen
Nguyet Nguyen 2022년 8월 13일
oh thank you

댓글을 달려면 로그인하십시오.

답변 (2개)

Karim
Karim 2022년 8월 13일
Hi, you can use the procedure below to investigate the range you are interested in.
% create the function
Fun = @(x,y) (x.^2+y.^2) .* exp(y.^2-x.^2);
% values to determine the range for X and Y, you can change these to investigate another range
minX = -2; % lower bound for X
maxX = 2; % upper bound for X
minY = -1;
maxY = 1;
step = 0.05; % give the step size
% create the grid points to evaluate the function
[X,Y] = meshgrid(minX:step:maxX, minY:step:maxY);
% evaluate the function at all points
Z = zeros(size(X));
Z(:) = Fun(X(:),Y(:));
% plot the result
figure
surf(X,Y,Z)
xlabel('X values')
ylabel('Y values')

Walter Roberson
Walter Roberson 2022년 8월 13일
Generally speaking, you might hope to stop drawing a surface at the point at which it gets boring, because the derivative becomes sufficiently close to 0 (the plot becomes visually close to steady state). This guide is not perfect as there are plots such as log where the derivative becomes arbitrarily close to 0 and yet the change after that point is infinite.
So that the derivative of the function with respect to x and try to solve() that for x in terms of y when (say) the derivative becoming 1/100 or -1/100
... The solve() will fail, indicating no closed form solution.
So fsurf the derivative in the range ±3 to get a better idea of what is going on. You will see that for x roughly 1/2 that the derivative is increasing rapidly as y gets larger. So the function does not die down.
Switch back to fsurf the original function over the same range and you will see that it rapidly gets larger with changes in y.
There is therefore a sense in which the function gets increasingly more interesting as the magnitude of y increases: the changes near 0 become "noise" compared to the changes further away from 0.
And therefore it could be argued that if you are going to plot the function at all, that it deserves an infinite plot.

카테고리

Help CenterFile Exchange에서 Discrete Data Plots에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by