This answer is now an appendix (how to add gridlines) to C.F.'s (better) answer above: shader=interp
is the surf
equivalent of smooth
, and it preserves the color scheme, unlike my original answer.
shader=interp
removes gridlines, but you add some of them back in, because of the above fact, thus:
\documentclass{article}\usepackage{pgfplots}\usepgfplotslibrary{patchplots}
\newcommand{\pt}{2}
\begin{document}\begin{tikzpicture}
\begin{axis}[3d box,width=8cm,view={147}{56},
domain=0:0.4,y domain=0:0.4,samples=32,
xlabel=$x$,ylabel=$y$,zlabel={$z$},]
\addplot3[surf,domain=0:0.4,y domain=0:0.4,unbounded coords=jump,shader=interp]
{%
x^(-\pt-1)*y^(-\pt-1)*(x^(-\pt)+y^(-\pt)-1)^(-1/\pt-2)+\pt*x^(-\pt-1)*y^(-\pt-1)*(x^(-\pt)+y^(-\pt)-1)^(-1/\pt-2)%
};
\addplot3[domain=0:0.4,y domain=0:0.4,unbounded coords=jump,smooth]
{%
x^(-\pt-1)*y^(-\pt-1)*(x^(-\pt)+y^(-\pt)-1)^(-1/\pt-2)+\pt*x^(-\pt-1)*y^(-\pt-1)*(x^(-\pt)+y^(-\pt)-1)^(-1/\pt-2)%
};
\end{axis}\end{tikzpicture}\end{document}
The gridlines themselves are:
Smoothing via cubic bézier curves is implemented in pgfplots. (See p.76 of the pgfplots manual.)
\addplot3[...,smooth,...]
for line only or \addplot+[...,smooth,...]
gives the above and fill it with blue points.
Consider
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[view={40}{50}]
\addplot3 [y domain = 0:2,smooth]{-0.7+4*exp(-0.5*(x+3))*(3*cos(4*x*180/pi)+2.5*cos(2*x*180/pi))+0.5*y*y*4};
\end{axis}
\end{tikzpicture}
\end{document}
and compare to unsmoothed version
\documentclass{standalone}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[view={40}{50}]
\addplot3 [y domain = 0:2]{-0.7+4*exp(-0.5*(x+3))*(3*cos(4*x*180/pi)+2.5*cos(2*x*180/pi))+0.5*y*y*4};
\end{axis}
\end{tikzpicture}
\end{document}
True, there is a problem with color. The equation in the question is 1/x^5*1/y^3+ 2/x^5*1/y^3+2*y^(9/2) reduced. It's very sharp and using 256 samples for example instead causes main memory to run out and TeX halts compiling... Smooth with around 100 samples and rotating the view may be the only option, when used with a compatible color scheme to return the surface fill.
samples = 50, samples y= 50
samples = 70, samples y = 70
- it doesn't seem to have any visible effect.