# Surface Integral in 3D

I need a example picture for surface integrals of any function in a three-dimensional space. Wich function it is is not important. I need help getting this job started. The image is not that good, but I think you got the idea. I know some tikz basics and also drew some vectors in 3D but i don't have a clue how to make one like this. This was all i was able to do:

\usepackage{tikz}
\usepackage{tikz-3dplot}
\usepackage{pgfplots}
\usetikzlibrary{calc,angles,3d,babel,intersections,pgfplots.fillbetween}

\centering
\begin{tikzpicture}
\coordinate (zero) at (0,0,0);
\coordinate (x) at (0,0,5);
\coordinate (y) at (5,0,0);
\coordinate (z) at (0,5,0);
\coordinate (x1) at (0,0,2);
\coordinate (x2) at (0,0,3);
\coordinate (y1) at (2,0,0);
\coordinate (y2) at (3,0,0);
\coordinate (xx1) at (2,0,2);
\coordinate (xx2) at (2,0,3);
\coordinate (yy2) at (3,0,2);
\coordinate (xy1) at (3,0,3);
\draw[->] (zero) -- (x) node[above]{$x$};
\draw[->] (zero) -- (y) node[above]{$y$};
\draw[->] (zero) -- (z) node[right]{$z$};
\draw[dashed] (x1) -- ++(y1);
\draw[dashed] (x2) -- ++(y2);
\draw[dashed] (y1) -- ++(x1);
\draw[dashed] (y2) -- ++(x2);
\draw (xx1) -- (xx2);
\draw (xx1) -- (yy2);
\draw (xy1) -- (xx2);
\draw (xy1) -- (yy2);
\draw (0,3,0) to [bend left=40] (5,1,0);
\draw (0,3,1) to [bend left=40] (5,1,1);
\draw (0,3,2) to [bend left=40] (5,1,2);
\draw (0,3,3) to [bend left=40] (5,1,3);
\draw (0,3,4) to [bend left=40] (5,1,4);
\draw (0,3,5) to [bend left=40] (5,1,5);
\draw [name path=A] (5,1,0) to [bend right=40] (5,1,5);
\path [name path=B] (5,1,0) -- (5,1,5);
\tikzfillbetween[of=A and B]{white, opacity=1};
\draw[->] (zero) -- (y) node[above]{$y$};
\end{tikzpicture}


• Welcome to TeX.SX. Questions about how to draw specific graphics that just post an image of the desired result are really not reasonable questions to ask on the site. Please post a minimal compilable document (MWE) showing that you've tried to produce the image and then people will be happy to help you with any specific problems you may have. You could for example have a look at a TikZ manual or at some example sites (like texample.net) to get started.
– TivV
Commented Feb 25, 2020 at 17:40
• thanks i added some code now. Commented Feb 25, 2020 at 23:24

It is fairly straightforward to draw some graph that looks like the drawing. However, I am not sure how I understand how that relates to the description.

\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{70}{110}
\begin{tikzpicture}[tdplot_main_coords,line cap=round,>=stealth]
\draw[->] (0,0,0) coordinate (O) -- (5,0,0) node[pos=1.05]{$x$};
\draw[->] (O) -- (0,5,0) node[pos=1.05]{$y$};
\draw[->] (O) -- (0,0,5) node[pos=1.05]{$z$};
\begin{scope}[shift={(1,4,0)},declare function={fx(\x,\y)=0.5*\x*cos(\y);%
fy(\x,\y)=0.5*\x*sin(\y);fz(\x,\y)=0.3*\x;}]
\draw ({fx(5,270)},{fy(5,270)},0) -- ({fx(5,285)},{fy(5,285)},0)
-- ({fx(6,285)},{fy(6,285)},0) -- ({fx(6,270)},{fy(6,270)},0) -- cycle;
\foreach \X in {5,6} {\foreach \Y in {270,285}
{\draw[dashed] ({fx(\X,\Y)},{fy(\X,\Y)},0) -- ({fx(\X,\Y)},{fy(\X,\Y)},{fz(\X,\Y)});}}
\foreach \X in {5,6} {
\draw[dashed] ({fx(\X,270)},{fy(\X,270)},0) -- ({-1},{fy(\X,270)},0);}
\foreach \Y in {270,285}  {
\draw[dashed] ({fx(6,\Y)},{fy(6,\Y)},0) -- ({fx(6,\Y)},{-4},0);}
\foreach \X in {1,...,10}
{\draw plot[variable=\x,domain=240:300,smooth] ({fx(\X,\x)},{fy(\X,\x)},{fz(\X,\x)});
}
\foreach \X in {0,...,4}
{\draw ({fx(1,240+\X*15)},{fy(1,240+\X*15)},{fz(1,240+\X*15)})
-- ({fx(10,240+\X*15)},{fy(10,240+\X*15)},{fz(10,240+\X*15)});}
\draw[blue,thick] plot[variable=\x,domain=270:285] ({fx(5,\x)},{fy(5,\x)},{fz(5,\x)})
-- plot[variable=\x,domain=285:270] ({fx(6,\x)},{fy(6,\x)},{fz(6,\x)})
-- cycle;
\end{scope}
\end{tikzpicture}
\end{document}


\documentclass[tikz,border=3mm]{standalone}
\usepackage{tikz-3dplot}
\begin{document}
\tdplotsetmaincoords{70}{110}
\begin{tikzpicture}[tdplot_main_coords,line cap=round,>=stealth,
declare function={f(\x,\y)=3+0.5*sin(30*\x)*cos(30*\y);}]
\draw[->] (0,0,0) coordinate (O) -- (5,0,0) node[pos=1.05]{$x$};
\draw[->] (O) -- (0,5,0) node[pos=1.05]{$y$};
\draw[->] (O) -- (0,0,5) node[pos=1.05]{$z$};
\draw (1,2,0) -- (2,2,0)   -- (2,3,0) -- (1,3,0) -- cycle;
\foreach \X in {1,2} {\foreach \Y in {2,3}
{\draw[dashed] (\X,\Y,0) -- (\X,\Y,{f(\X,\Y)});}}
\foreach \X in {1,2} {
\draw[dashed] (\X,2,0) -- (\X,0,0);}
\foreach \Y in {2,3} {
\draw[dashed] (1,\Y,0) -- (0,\Y,0);}
\foreach \X in {0,...,4}
{\draw plot[variable=\x,domain=0:5,smooth] (\X,\x,{f(\X,\x)});
}
\foreach \Y in {0,...,5}
{\draw plot[variable=\x,domain=0:4,smooth] (\x,\Y,{f(\x,\Y)});
}
\draw[blue,thick] plot[variable=\x,domain=1:2]  (\x,2,{f(\x,2)})
-- plot[variable=\y,domain=2:3]  (2,\y,{f(2,\y)})
-- plot[variable=\x,domain=2:1]  (\x,3,{f(\x,3)})
-- plot[variable=\y,domain=3:2]  (1,\y,{f(1,\y)})
-- cycle;
\end{tikzpicture}
\end{document}


• that looks pretty good but i need the lower tetragon to be a square. The upper one should map this square in the function to show how the surface changes. Thanks anyway! Commented Feb 26, 2020 at 11:14