我想绘制 的三维图|n_B(z)| = (e^(2*x) - 2*e^x*cos(y) + 1)^(-1/2)
,其中是复变量 的|n_B(z)|
Bose-Einstein 分布的绝对值。(为简单起见,我设定了温度。)以下是我目前所得到的。n_B(z) = 1/(e^(z/T) - 1)
z = x + i y
T = 1
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=$\Re(p_0)$,
ylabel=$\Im(p_0)$,
zlabel=$n_B(p_0)$,
restrict z to domain*=0:2,
tickwidth=0pt
]
\addplot3[
surf,domain=-10:-5,y domain=-30:30,
blue!20,samples=5]
{1};
\addplot3[
surf,domain=-5:5,y domain=-30:30,
blue!20,samples=70]
{(e^(2*x) - 2*e^x*cos(deg(y)) + 1)^(-1/2)};
\addplot3[
surf,domain=5:10,y domain=-30:30,
blue!20,samples=5]
{0};
\end{axis}
\end{tikzpicture}
\end{document}
我将采样率提高到接近 TeX 的最大容量,并尝试将采样集中在真正重要的区域,方法是将函数近似为 0x >> 0
和 1,x << 0
其中函数几乎为常数。然而,该图仍然在奇点周围显示出小的伪影。任何关于如何改善外观和编译速度的建议都欢迎!
答案1
只是为了好玩:
\documentclass{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
xlabel=$\Re(p_0)$,
ylabel=$\Im(p_0)$,
zlabel=$n_B(p_0)$,
miter limit=1,
tickwidth=0pt
]
\addplot3[
surf,domain=-10:10,y domain=-10:10,
restrict z to domain*=0:1.2,
blue!20,samples=20,samples y=25]
{(e^(2*x) - 2*e^x*cos(deg(y)) + 1)^(-1/2)};
\addplot3[
surf,domain=-2:1,y domain=-10:10,
restrict z to domain*=0:1.5,
blue!20,samples=20,samples y=50]
{(e^(2*x) - 2*e^x*cos(deg(y)) + 1)^(-1/2)};
\addplot3[
surf,domain=-1:0.5,y domain=5.3:7.3,
restrict z to domain*=0:2,
blue!20,samples=20,samples y=20]
{(e^(2*x) - 2*e^x*cos(deg(y)) + 1)^(-1/2)};
\addplot3[
surf,domain=-1:0.5,y domain=-1:1,
restrict z to domain*=0:2,
blue!20,samples=20,samples y=20]
{(e^(2*x) - 2*e^x*cos(deg(y)) + 1)^(-1/2)};
\addplot3[
surf,domain=-1:0.5,y domain=-7.3:-5.3,
restrict z to domain*=0:2,
blue!20,samples=20,samples y=20]
{(e^(2*x) - 2*e^x*cos(deg(y)) + 1)^(-1/2)};
\end{axis}
\end{tikzpicture}
\end{document}