Bound 3D function with asymptote

I want to plot the function where . The function has an asymptote at so the z-axis continues very high if I use the following code (see figure for output):
syms x y
fsurf(exp(x)/(x^2+y^2))
I want to plot over a similar domain, or slightly smaller, but then have an upper bound such as at . I tried doing this by adding the line
zlim([0, 15])
which gave me more or less the shape that I want.
However, MATLAB is still calculating the colours based off the original figure, so everything is blue. How can I make MATLAB plot something similar to the second figure, and but also calculate colours based on the second figure. That is, not by simply trimming the first one.
Thank you!

 採用された回答

John D'Errico
John D'Errico 2022 年 8 月 17 日
編集済み: John D'Errico 2022 年 8 月 17 日

0 投票

Your problem is that zlim ONLY limits the plot axes. It does not impact the shape of the surface itself. Instead, define the surface as:
syms x y
fsurf(min(exp(x)/(x^2+y^2),15))
Do you see that here I created the function so that it is itself limited? Now the plotting tool is happy.

1 件のコメント

Jojo
Jojo 2022 年 8 月 17 日
Perfect thank you.

サインインしてコメントする。

その他の回答 (1 件)

カテゴリ

製品

リリース

R2021b

タグ

質問済み:

2022 年 8 月 17 日

コメント済み:

2022 年 8 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by