I want to plot the function 1/(x²+y²), but since it tends to infinity in (0,0), I get a horrible plot:
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[grid=both]
\addplot3 [surf] {1 / (x^2 + y^2)};
\end{axis}
\end{tikzpicture}
\end{document}
By restricting the domain of z, I get anyway a not so nice plot:
\documentclass{article}
\usepackage{tikz}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[grid=both,restrict z to domain=0:1]
\addplot3 [surf] {1 / (x^2 + y^2)};
\end{axis}
\end{tikzpicture}
\end{document}
I would like to get something smooth, which finish in a circle (the circle of the intersection of this function with the plane z=1 for example).
Something like this would be great:







