答案1
可以ceil
在这里使用该功能。
\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\begin{tikzpicture}
\begin{axis}[hide axis,declare function={f(\x)=sqrt(ceil(\x));}]
\addplot3[domain=0:10,domain y=0:360,surf,z buffer=sort,
shader=interp,samples=51,samples y=36]
(x,{f(x)*cos(y)},{f(x)*sin(y)});
\addplot3[domain=0:360,fill=gray,samples=36]
(10,{f(10)*cos(x)},{f(10)*sin(x)});
\end{axis}
\end{tikzpicture}
\end{document}
将其转化为问题中建议的参数化的一种方法是
\documentclass[tikz,border=3mm]{standalone}
\usepackage{pgfplots}
\pgfplotsset{compat=1.17}
\begin{document}
\begin{tikzpicture}
\begin{axis}[hide axis,
declare function={n=7;% <- number of steps
tmin=0;% <- lower bound
tmax=10;% <- upper bound
sampling=8;% <- increasing this will make the steps more steplike, but also increase the compilation time
f(\x)=sqrt(ceil(\x*n/(tmax-tmin)));}]
\addplot3[domain=tmin:tmax,domain y=0:360,surf,z buffer=sort,
shader=interp,samples=sampling*n+1,samples y=36]
(x,{f(x)*cos(y)},{f(x)*sin(y)});
\end{axis}
\end{tikzpicture}
\end{document}