3

I want to draw something like this enter image description here

For the moment I just managed to draw a 3D plate and I don't know how to do it with the 3D sinus curves. I managed to draw something like that, but I don't know how to do for have 2 color in the curve and the same shape. It's not that good !!

\documentclass {standalone}
\usepackage{pgfplots}
\pgfplotsset{compat = newest}

\begin{document}

\begin{tikzpicture}


\begin{axis}[hide axis]
\addplot3 [
domain=-2:2,
domain y = -2:2,
samples = 40,
samples y = 40,
surf,
fill=pink,
faceted color = teal] {-exp(-(x^2+y^2)/1.3};
\end{axis}


\end{tikzpicture}

\end{document}

enter image description here

Could you help me?!

1
  • Please show what you have tried and describe where you are stuck. Jan 25, 2022 at 16:40

1 Answer 1

5

I am not sure I understand what your question is - it seems like you did it. -anyway here the surface is with two colors and some curves. Please ask, if I have misunderstood or you have trouble adding the rest.

\documentclass[border=1cm]{standalone}
\usepackage{amsmath}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\pgfplotsset{colormap={violet}{rgb255=(25,25,122) rgb255=(238,140,238) color=(white)}}
\begin{document}
\begin{tikzpicture}[
declare function={
 f(\x,\y)=-exp(-(\x^2+\y^2)/1.3;
}]
\begin{axis}[
view={30}{20},
mesh/interior colormap name=violet,
colormap/viridis,
hide axis,
xmin=-2, xmax=2,
ymin=-2, ymax=2,
zmin=-2.5, zmax=0,
]
\addplot3[
domain=-2:2,
domain y=-2:2,
samples=40,
samples y=40,
surf,
] {f(\x,\y)};
\addplot3[
domain=-2:2,
samples=40,
samples y=1,
smooth,
] ( x , -2 , {f(\x,0)});
\addplot3[
domain=-2:2,
samples=40,
samples y=1,
smooth,
] ( x , -2 , {f(\x,1)});
\draw[->, thick] (0,-2,0) -- node[font=\tiny, pos=0.7, right=-2pt]{$W_{\text{max}}$} (0,-2, {f(0,0)});
\end{axis}
\end{tikzpicture}
\end{document}

Surface graph with curves at the side

Edit with thickness:

\documentclass[border=1cm]{standalone}
\usepackage{amsmath}
\usepackage{pgfplots}
\pgfplotsset{compat=1.18}
\pgfplotsset{colormap={violet}{rgb255=(25,25,122) rgb255=(238,140,238) color=(white)}}
\begin{document}
\begin{tikzpicture}[
declare function={
 f(\x,\y)=-exp(-(\x^2+\y^2)/1.3;
}]
\begin{axis}[
view={30}{20},
mesh/interior colormap name=violet,
colormap/viridis,
hide axis,
xmin=-2, xmax=2,
ymin=-2, ymax=2,
zmin=-2.5, zmax=0,
]
\addplot3[
domain=-2:2,
domain y=-2:2,
samples=40,
samples y=40,
surf,
] {f(\x,\y)};
\addplot3[
domain=-2:2,
domain y=0:360,
samples=40,
samples y=2,
surf,
] (x,-2,{f(\x,-2)-0.05*sin(\y r)});
\addplot3[
domain=-2:2,
domain y=0:360,
samples=40,
samples y=2,
surf,
] (2,x,{f(\x,2)-0.05*sin(\y r)});
\addplot3[
domain=-2:2,
samples=40,
samples y=1,
smooth,
] ( x , -2 , {f(\x,0)});
\addplot3[
domain=-2:2,
samples=40,
samples y=1,
smooth,
] ( x , -2 , {f(\x,1)});
\draw[->, thick] (0,-2,0) -- node[font=\tiny, pos=0.7, right=-2pt]{$W_{\text{max}}$} (0,-2, {f(0,0)});
\end{axis}
\end{tikzpicture}
\end{document}

Surface graph

3
  • It's perfect but how to give the plate a thickness? (noted h in the reference picture)
    – sobat
    Jan 26, 2022 at 15:40
  • It is not possible as such. You can repeat the plot twice with an offset, and clip it to the rectangle, but I doubt that you will be able to see a small difference in the height of the interior and exterior. The only thing really needed is an edge band sticking down from the two front edges. You can use \fill or two separate surf plots. Jan 26, 2022 at 16:29
  • thank you very much for your help! it works by changing the xmax and xmin
    – sobat
    Jan 26, 2022 at 16:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .