Intersection of 2 surface plots in pgfplots

My question is pretty much a duplicate of this one. I'd like pgfplots to display the intersection between tho surface plots properly. Unfortunately, my function is quite different from the one in the mentioned question, so I don't know, where the surfaces will meet. Would there be any kind of workaround for this kind of function?

\documentclass{scrartcl}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=0.01:30]
\addplot3[surf] {0};
\addplot3[surf] {(1-0.3)*e^(-x*(y/100)*(1-0.3))-e^(-x*(y/100))};
\end{axis}
\end{tikzpicture}
\end{document}


-
Unfortunately, I think this is a job for PSTricks... – Jake Sep 24 '12 at 19:05
As Jake already said, this is beyond the capabilities of pgfplots. The golatex forum has a related post in which the OP managed to generate the graphics as such with matlab and imported it via \addplot3 graphics: golatex.de/… (in german only - but pictures speak in their own language, I guess) – Christian Feuersänger Sep 25 '12 at 18:40

2 Answers

Another hackish solution:

\documentclass{scrartcl}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=0.01:30]
\addplot3[surf] {min(0.,(1-0.3)*e^(-x*(y/100)*(1-0.3))-e^(-x*(y/100))};
\addplot3[surf] {max(0.,(1-0.3)*e^(-x*(y/100)*(1-0.3))-e^(-x*(y/100)))};
\addplot3[domain=4:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({x},{118.89/x},{0.});
\addplot3[domain=0:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({x},{30.},{max(0.,(1-0.3)*e^(-x*(30./100)*(1-0.3))-e^(-x*(30./100)))});
\addplot3[domain=0:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({x},{0.},{max(0.,(1-0.3)*e^(-x*(0./100)*(1-0.3))-e^(-x*(0./100)))});
\addplot3[domain=0:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({x},{0.},{min(0.,(1-0.3)*e^(-x*(0./100)*(1-0.3))-e^(-x*(0./100)))});
\addplot3[domain=0:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({0.},{x},{max(0.,(1-0.3)*e^(-0.*(x/100)*(1-0.3))-e^(-0.*(x/100)))});
\addplot3[domain=0:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({30.},{x},{max(0.,(1-0.3)*e^(-30.*(x/100)*(1-0.3))-e^(-30.*(x/100)))});
\addplot3[domain=0:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({30.},{x},{min(0.,(1-0.3)*e^(-30.*(x/100)*(1-0.3))-e^(-30.*(x/100)))});
\end{axis}
\end{tikzpicture}
\end{document}


Note that this kind of solution is less flexible, because the correct hidden surface removal depends on the position of the camera, and also on special properties of shape of the functions. If one could know the point of view internally, one could generalize the max and min function to make it camera dependent and in this way simulate hidden surfaces.

-
Thanks a lot for both your solutions. Would you be so kind as to explain the rationale behind the value 118.89 and especially behind the second solution? I won't need different camera angles, but I will need to plot a lot of similar functions. – meep.meep Sep 25 '12 at 8:20
Second solution meaning this one, the order changed because of my accepting this answer. – meep.meep Sep 25 '12 at 9:20
I got the solution by myself. I just was missing the rule: ln(e^{f(x)}) = f(x). Using that, I now understand where the 118.89 come from. Thanks again. – meep.meep Sep 25 '12 at 14:06

A combination of surface colors, opacities and parametric plots can get you close to the desired result:

Code follows:

\documentclass{scrartcl}
\usepackage{pgfplots}
\begin{document}
\begin{tikzpicture}
\begin{axis}[domain=0.01:30]
\addplot3[surf, opacity=0.25, blue, shader=flat] {0};
\addplot3[surf, opacity=0.25] {(1-0.3)*e^(-x*(y/100)*(1-0.3))-e^(-x*(y/100))};
\addplot3+[domain=4:30,samples=80,samples y=0,mark=none,black, opacity=0.5,thick]({x},{118.89/x},{0.});
\end{axis}
\end{tikzpicture}
\end{document}

-