我怎样才能绘制附图TikZ
?
\documentclass[border=10pt,tikz]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{shapes,arrows,positioning,arrows.meta,decorations.markings,shapes}
\begin{document}
\begin{tikzpicture}[line width=.25mm,font=\scriptsize,scale=.7]
\draw[->] (0,0) -- (5,0)node[below]{$x_3$};
\draw[<->] (2,-2.5) node[below]{$x_2$} -- (2,0) -- (9,4) node[right]{$x_1$};
\draw(0,0) -- (0,-4) -- (4,-4) -- (4,0);
\draw (0,0) -- (6,3.5) -- (10,3.5) -- (4,0);
\draw (10,3.5) -- (10,0) -- (4,-4);
\draw[line width=.35mm] (0,-1) -- (4,-1) -- (10,2.5);
\draw[->] (1.25,-.7) node[left]{$h$} -- (1.9,-.9);
\end{tikzpicture}
\end{document}
答案1
这是首次尝试。
\documentclass[border=10pt,tikz]{standalone}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows.meta,intersections,3d}
\begin{document}
\begin{tikzpicture}[x={(32.5:10mm)},y={(0:20mm)},z={(-90:15mm)},>=Latex]
\def\wave{
\draw[thick](1,1) cos (2,0) sin (3,-1) cos (4,0)
sin (5,1) cos (6,0) sin (7,-1) cos (8,0)
sin (9,1) cos (10,0)sin (11,-1)cos (12,0);
\clip (2,-1.2) rectangle (13,1.2);
\foreach \shift in {0,4,8}
{
\begin{scope}[xshift=\shift cm,thin,->]
\draw(.25,0) -- (0.25,0 |- 22.5:1cm);
\draw(.5,0) -- (0.5,0 |- 45:1cm);
\draw(.75,0) -- (0.75,0 |- 67.5:1cm);
\draw (1,0) -- (1,1);
\draw(1.25,0) -- (1.25,0 |- 67.5:1cm);
\draw (1.5,0) -- (1.5,0 |- 45:1cm);
\draw(1.75,0) -- (1.75,0 |- 22.5:1cm);
\draw (2.25,0) -- (2.25,0 |- -22.5:1cm);
\draw (2.5,0) -- (2.5,0 |- -45:1cm);
\draw(2.75,0) -- (2.75,0 |- -67.5:1cm);
\draw (3,0) -- (3,-1);
\draw (3.25,0) -- (3.25,0 |- -67.5:1cm);
\draw (3.5,0) -- (3.5,0 |- -45:1cm);
\draw(3.75,0) -- (3.75,0 |- -22.5:1cm);
\end{scope}
}
}
\draw[->,name path=x2] (1,0,0) -- (1,0,2.5)node[right]{$x_2$};
\draw[->] (1,0,0) -- (13,0,0)node[above right]{$x_1$};
\draw[->] (1,0,0) -- (1,2,0)node[below right]{$x_3$};
\begin{scope}[canvas is xy plane at z=0]
\draw (1,-1.5) rectangle (12,1.5)coordinate(v1);
\clip (0.85,-1.1) rectangle (13,1.1);
\wave
\end{scope}
\begin{scope}[canvas is zy plane at x=1]
\draw[thick,domain=0:2] plot (\x,{exp(-\x^2)});
\foreach \pexp in {0.25,0.5,...,1.5}
\draw[->] (\pexp,0) -- (\pexp,{exp(-\pexp^2)});
\draw (0,-1.5) rectangle (4,1.5)coordinate(v2);
\end{scope}
\begin{scope}[canvas is xy plane at z=1]
\draw[thick,name path global=subpl] (1,-1.5) |- (12,1.5) node[pos=0.8,above,text width=6ex](scrv1){Layer\\$v_1$};
\node[below=2cm of scrv1,text width=6ex,align=center]{Substrate\\$v_2$};
\node[below=6cm of scrv1]{$v_2>v_1$};
\end{scope}
\begin{scope}[canvas is xz plane at y=1]
\draw (v1) |- (v2);
\end{scope}
\draw [name intersections={of=x2 and subpl,by=h},<-,shorten >=-2pt,shorten <=2pt] (h) -- +(120:5mm)node[above left]{h};
\end{tikzpicture}
\end{document}