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

5 Ansichten (letzte 30 Tage)
Nguyet Nguyen
Nguyet Nguyen am 13 Aug. 2022
Beantwortet: Walter Roberson am 13 Aug. 2022
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 Kommentare
Rik
Rik am 13 Aug. 2022
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 am 13 Aug. 2022
oh thank you

Melden Sie sich an, um zu kommentieren.

Antworten (2)

Karim
Karim am 13 Aug. 2022
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 am 13 Aug. 2022
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.

Kategorien

Mehr zu Discrete Data Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by