在 TikZ 中说明塞贝克效应

在 TikZ 中说明塞贝克效应

我正在尝试复制此图像(来源) 在 TikZ 中。

在此处输入图片描述

我刚开始做这些,但对接下来要做的 3d 对象有点畏惧。TikZ 向导能否建议我如何做/处理这个问题?

\documentclass[tikz]{standalone}

\usepackage{circuitikz}
\usetikzlibrary{decorations.markings}

\begin{document}
  \begin{circuitikz}[decoration={%
    markings,%
    mark=at position 0.05 with {\arrow[black]{stealth};},%
    mark=at position 0.4 with {\arrow[black]{stealth};},%
    mark=at position 0.6 with {\arrow[black]{stealth};},%
    mark=at position 0.95 with {\arrow[black]{stealth};}}]
    \draw[postaction={draw,decorate}] (3,0) to (5,0) to (5,-5) to[resistor] (-5,-5) to (-5,0) to (-3,0);
  \end{circuitikz}
\end{document}

答案1

用矩形制作长方体。

在此处输入图片描述

\documentclass[border=3mm]{standalone}
\usepackage{circuitikz}
\usetikzlibrary{3d,positioning,decorations.markings}
\tikzset{
decoration={%
    markings,%
    mark=at position 0.05 with {\arrow[black]{stealth};},%
    mark=at position 0.4 with {\arrow[black]{stealth};},%
    mark=at position 0.6 with {\arrow[black]{stealth};},%
    mark=at position 0.95 with {\arrow[black]{stealth};}},
vert/.style ={bottom color=blue!50, top color=red},
pics/.cd,
  pic a/.style={code={
      \node [fill=orange, shape=circle, inner sep=0pt] (pc) {+};
      \draw[thick,->] (pc)--++(0,-0.5);
  }},
}
\begin{document}
\begin{circuitikz}[scale=0.5,font=\sffamily,>=stealth]

\begin{scope}
% heat sink 1
\draw[fill=blue] (0,0,0) rectangle ++(6,1.5,0)node[midway,color=white]{heat sink};
\draw[fill=blue] (6,0,0) -- ++(0,1.5,0) -- ++(0,0,-3) -- ++(0,-1.5,0) -- cycle;
\draw[fill=blue] (0,1.5,0) -- ++(6,0,0) -- ++(0,0,-3) -- ++(-6,0,0) -- cycle;

\draw[vert,opacity=0.5] (0.5,1.5,-2.8) -- ++(0,10,0);
\draw[vert,opacity=0.5] (0.5,1.5,-2.8) -- ++(5,0,0);
\draw[vert,opacity=0.5] (0.5,1.5,-2.8) -- ++(0,0,2.6);
\fill[vert,opacity=0.7] (0.5,1.5,-0.2) rectangle ++(5,10,0);
\fill[vert,opacity=0.7] (5.5,1.5,-0.2) -- ++(0,10,0) -- ++(0,0,-2.6) -- ++(0,-10,0) -- cycle;
\end{scope}

\begin{scope}[xshift=15cm]
% heat sink 2
\draw[fill=blue] (0,0,0) rectangle ++(6,1.5,0)node[midway,color=white]{heat sink};
\draw[fill=blue] (6,0,0) -- ++(0,1.5,0) -- ++(0,0,-3) -- ++(0,-1.5,0) -- cycle;
\draw[fill=blue] (0,1.5,0) -- ++(6,0,0) -- ++(0,0,-3) -- ++(-6,0,0) -- cycle;

\draw[vert,opacity=0.5] (0.5,1.5,-2.8) -- ++(0,10,0);
\draw[vert,opacity=0.5] (0.5,1.5,-2.8) -- ++(5,0,0);
\draw[vert,opacity=0.5] (0.5,1.5,-2.8) -- ++(0,0,2.6);
\fill[vert,opacity=0.7] (0.5,1.5,-0.2) rectangle ++(5,10,0)node[midway](P){};
\fill[vert,opacity=0.7] (5.5,1.5,-0.2) -- ++(0,10,0) -- ++(0,0,-2.6) -- ++(0,-10,0) -- cycle;
\end{scope}

% heat source
\draw[fill=red] (0,11.5,0) rectangle ++(21,1.5,0)node[midway]{$J\rightarrow$};
\draw[fill=red] (21,11.5,0) -- ++(0,1.5,0) -- ++(0,0,-3) -- ++(0,-1.5,0) -- cycle;
\draw[fill=red] (0,13,0) -- ++(21,0,0) -- ++(0,0,-3) -- ++(-21,0,0) -- cycle;

% resistor
\draw[postaction={decorate}] (21,0.75,-1.5) -- ++ (3,0,0) -- ++(0,-3,0) to[R] ++ (-27,0,0) |- (0,0.75,0);

%arrow
\draw[thick,-stealth] (5.5,10,-1.5) node[right=3mm]{+} -- ++(0,-7,0)node[right=3mm]{-};

% 
\draw (P) node[draw,circle]{P};
\pic[below left=5mm] at (P) {pic a};
\pic[below right=5mm] at (P) {pic a};
\end{circuitikz}
\end{document}

答案2

这是一个快速编写的提案,旨在更系统地绘制具有渐变阴影的长方体。大多数方面都由 pgf 键控制,如果它们的名称不直观,我深表歉意。对于锯齿形装饰,您不一定需要circuitikz,所以我认为添加电路应该相当简单。

\documentclass[tikz,border=3.14mm]{standalone}
\newif\ifcuboidshaded
\cuboidshadedfalse
\usepackage{tikz-3dplot}
\tikzset{get projections/.style={insert path={%
let \p1=(1,0,0),\p2=(0,1,0)  in 
[/utils/exec={\pgfmathtruncatemacro{\xproj}{sign(\x1)}\xdef\xproj{\xproj}
\pgfmathtruncatemacro{\yproj}{sign(\x2)}\xdef\yproj{\yproj}
\pgfmathtruncatemacro{\zproj}{sign(cos(\tdplotmaintheta))}\xdef\zproj{\zproj}}]}},
pics/cuboid/.style={code={\tikzset{cuboid/.cd,#1}
 \path[get projections];
 % bottom face
 \draw let \p1=($(1,0,0)-(0,0,0)$),\n1={atan2(\y1,\x1)} 
  in [/tikz/cuboid/every face,/tikz/cuboid/bottom face]
  \ifcuboidshaded [shading angle=\n1] \fi
     (0,-\cubey/2,0) -- ++(\cubex,0,0) -- ++(0,\cubey,0) --
     ++(-\cubex,0,0) -- cycle;
 \ifnum\yproj=1
  \draw let \p1=($(0,1,0)-(0,0,0)$),\n1={atan2(\y1,\x1)} 
  in [/tikz/cuboid/every face,/tikz/cuboid/yz face] 
  \ifcuboidshaded [shading angle=\n1] \fi
  (0,-\cubey/2,0) -- ++(0,0,\cubez) -- ++(0,\cubey,0) -- ++(0,0,-\cubez) -- cycle;
 \else
  \draw let \p1=($(0,1,0)-(0,0,0)$),\n1={atan2(\y1,\x1)}  
  in [/tikz/cuboid/every face,/tikz/cuboid/yz face]
  \ifcuboidshaded [shading angle=\n1] \fi
  (0+\cubex,-\cubey/2,0) -- ++(0,0,\cubez) -- ++(0,\cubey,0) -- ++(0,0,-\cubez) -- cycle;
 \fi
 \ifnum\xproj=1             
  \draw let \p1=($(1,0,0)-(0,0,0)$),\n1={atan2(\y1,\x1)+180} 
  in [/tikz/cuboid/every face,/tikz/cuboid/xz face]
  \ifcuboidshaded [shading angle=\n1] \fi
     (0,\cubey/2,0) -- ++(\cubex,0,0) -- ++(0,0,\cubez) -- ++(-\cubex,0,0) -- cycle;
 \else
  \draw let \p1=($(1,0,0)-(0,0,0)$),\n1={atan2(\y1,\x1)+180} 
  in  [/tikz/cuboid/every face,/tikz/cuboid/xz face]
  \ifcuboidshaded [shading angle=\n1] \fi
     (0,-\cubey/2,0) -- ++(\cubex,0,0) -- ++(0,0,\cubez) -- ++(-\cubex,0,0) -- cycle;
 \fi
 \ifnum\yproj=-1
  \draw let \p1=($(0,1,0)-(0,0,0)$),\n1={atan2(\y1,\x1)} 
  in [/tikz/cuboid/every face,/tikz/cuboid/yz face]
  \ifcuboidshaded [shading angle=\n1] \fi 
  (0,-\cubey/2,0) -- ++(0,0,\cubez) -- ++(0,\cubey,0) -- ++(0,0,-\cubez) -- cycle;
 \else
  \draw let \p1=($(0,1,0)-(0,0,0)$),\n1={atan2(\y1,\x1)}  
  in [/tikz/cuboid/every face,/tikz/cuboid/yz face]
  \ifcuboidshaded [shading angle=\n1] \fi
  (0+\cubex,-\cubey/2,0) -- ++(0,0,\cubez) -- ++(0,\cubey,0) -- ++(0,0,-\cubez) -- cycle;
 \fi
 \ifnum\xproj=-1             
  \draw let \p1=($(1,0,0)-(0,0,0)$),\n1={atan2(\y1,\x1)+180} 
  in [/tikz/cuboid/every face,/tikz/cuboid/xz face]
  \ifcuboidshaded [shading angle=\n1] \fi
     (0,\cubey/2,0) -- ++(\cubex,0,0) -- ++(0,0,\cubez) -- ++(-\cubex,0,0) -- cycle;
 \else
  \draw let \p1=($(1,0,0)-(0,0,0)$),\n1={atan2(\y1,\x1)+180} 
  in  [/tikz/cuboid/every face,/tikz/cuboid/xz face]
  \ifcuboidshaded [shading angle=\n1] \fi
     (0,-\cubey/2,0) -- ++(\cubex,0,0) -- ++(0,0,\cubez) -- ++(-\cubex,0,0) -- cycle;
 \fi
 \draw let \p1=($(1,0,0)-(0,0,0)$),\n1={atan2(\y1,\x1)} 
  in [/tikz/cuboid/every face,/tikz/cuboid/top face]
  \ifcuboidshaded [shading angle=\n1] \fi
     (0,-\cubey/2,\cubez) -- ++(\cubex,0,0) -- ++(0,\cubey,0) --
     ++(-\cubex,0,0) -- cycle;}},
 cuboid/.cd,x/.estore in=\cubex,y/.estore in=\cubey,z/.estore
 in=\cubez,rounding/.estore in=\rounding,rounding=0.2pt,
 every face/.style={fill=blue},bottom face/.style={},top face/.style={},
 xz face/.style={},yz face/.style={},shaded/.code=\cuboidshadedtrue  
}
%%%%%%%%%%%
\begin{document}

\tdplotsetmaincoords{75}{110}

\begin{tikzpicture}[tdplot_main_coords]
  \pgfmathsetmacro{\cubedist}{4}
  \path[cuboid/.cd,x=2.4,y=4.8,z=1,
  every face/.style={fill=blue}] 
  (0,-\cubedist,-1) pic{cuboid} 
  (0,\cubedist,-1) pic{cuboid};  
  % 
  \path[fill opacity=0.3,cuboid/.cd,shaded,x=2,y=4,z=4,xz face/.style={top color=orange,bottom color=blue},
   yz face/.style={top color=red,bottom color=blue},
   bottom face/.style={fill=blue},top face/.style={fill=red}] 
   (0,-\cubedist,0) pic{cuboid} (0,\cubedist,0) pic{cuboid};  
  \path[cuboid/.cd,x=2.5,y=12.4,z=1,every face/.style={fill=red}] 
  (0,0,4) pic{cuboid};
\end{tikzpicture}
\end{document}

在此处输入图片描述

答案3

感谢 nidhin 和 user121799 的大力帮助,这就是我最终得到的结果。

在此处输入图片描述

\documentclass[border=3mm]{standalone}

\usepackage{circuitikz}
\usetikzlibrary{3d,positioning,decorations.markings}

\tikzset{
decoration={%
  markings,%
  mark=at position 0.05 with {\arrow[black]{stealth};},%
  mark=at position 0.4 with {\arrow[black]{stealth};},%
  mark=at position 0.6 with {\arrow[black]{stealth};},%
  mark=at position 0.95 with {\arrow[black]{stealth};}},
gradient/.style ={bottom color=blue!50, top color=red},
pics/.cd,
  p charge/.style={code={
      \node [fill=orange, shape=circle, inner sep=0pt] (pc) {+};
      \draw[thick,->] (pc)--++(0,-0.5);
  }},
  n charge/.style={code={
      \node [fill=cyan, shape=circle, inner sep=1pt, scale=1.2] (nc) {-};
      \draw[thick,->] (nc)--++(0,-0.5);
  }},
}

\newcommand\heatsink{
  \draw[fill=blue] (0,0,0) rectangle ++(6,1.5,0)node[midway,color=white]{heat sink};
  \draw[fill=blue] (6,0,0) -- ++(0,1.5,0) -- ++(0,0,-3) -- ++(0,-1.5,0) -- cycle;
  \draw[fill=blue] (0,1.5,0) -- ++(6,0,0) -- ++(0,0,-3) -- ++(-6,0,0) -- cycle;

  \draw[gradient,opacity=0.5] (0.5,1.5,-2.8) -- ++(0,10,0);
  \draw[gradient,opacity=0.5] (0.5,1.5,-2.8) -- ++(5,0,0);
}

\begin{document}
\begin{circuitikz}[scale=0.4,font=\sffamily,>=stealth]

  \begin{scope}
  % heat sink 1
  \heatsink
  \draw[gradient,opacity=0.5] (0.5,1.5,-2.8) -- ++(0,0,2.6);
  \fill[gradient,opacity=0.7] (5.5,1.5,-0.2) -- ++(0,10,0) -- ++(0,0,-2.6) -- ++(0,-10,0) -- cycle;
  \fill[gradient,opacity=0.7] (0.5,1.5,-0.2) rectangle ++(5,10,0)node[midway,draw,circle,white](N){N};
  \pic[below left=8mm and 3mm] at (N) {n charge};
  \pic[below right=7mm and 6mm] at (N) {n charge};
  \pic[above left=1cm and 3mm] at (N) {n charge};
  \pic[above right=1cm and 5mm] at (N) {n charge};
  \end{scope}

  \begin{scope}[xshift=15cm]
  % heat sink 2
  \heatsink
  \draw[gradient,opacity=0.5] (0.5,1.5,-2.8) -- ++(0,0,2.6);
  \fill[gradient,opacity=0.7] (5.5,1.5,-0.2) -- ++(0,10,0) -- ++(0,0,-2.6) -- ++(0,-10,0) -- cycle;
  \fill[gradient,opacity=0.7] (0.5,1.5,-0.2) rectangle ++(5,10,0)node[midway,draw,circle,white](P){P};
  \pic[below left=8mm and 3mm] at (P) {p charge};
  \pic[below right=7mm and 6mm] at (P) {p charge};
  \pic[above left=1cm and 3mm] at (P) {p charge};
  \pic[above right=1cm and 5mm] at (P) {p charge};
  \end{scope}

  % heat source
  \draw[fill=red] (0,11.5,0) rectangle ++(21,1.5,0) node[midway,white] (J) {$J\longrightarrow$};
  \draw[fill=red] (21,11.5,0) -- ++(0,1.5,0) -- ++(0,0,-3) -- ++(0,-1.5,0) -- cycle;
  \draw[fill=red] (0,13,0) -- ++(21,0,0) node[color=white,anchor=south,pos=0.5]{heat source} -- ++(0,0,-3) -- ++(-21,0,0) -- cycle;

  % electric field
  \node[below=1cm,scale=1.3] at (11,10) {electric field};
  \draw[thick,-stealth] (6.8,10,-1.5) node[below right=1mm]{+} -- ++(0,-7,0)node[above right=1mm,scale=1.2]{--};
  \draw[thick,-stealth] (14.1,3,-1.5) node[above left=1mm]{+} -- ++(0,7,0)node[below left=1mm,scale=1.2]{--};

  % resistor
  \draw[postaction={decorate}] (21,0.75,-1.5) -- ++ (3,0,0) -- ++(0,-3,0) to[R] ++ (-27,0,0) |- (0,0.75,0);

\end{circuitikz}
\end{document}

相关内容