
你好,我想用乳膠畫這個簡單的圖形,
有人可以幫我嗎?
答案1
這是一種可能性,使用TikZ
和鏈條:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{fit,chains}
\begin{document}
\begin{tikzpicture}[
simple/.style={draw,text width=1.5cm,align=center,minimum size=2.5em},
start chain,
node distance=12mm
]
\node[on chain] (xn) {$x[n]$};
\node[on chain,simple] (dft) {DFT};
\node[on chain,simple] (log) {log};
\node[on chain,simple] (idf) {IDFT};
\node[on chain] (cn) {$c[n]$};
\node[draw,dashed, fit= (dft) (idf),inner sep=12pt] {};
\draw[->] (xn) -- (dft);
\draw[->] (dft) -- node[auto] {$X[k]$} (log);
\draw[->] (log) -- node[auto] {$\hat{X}[k]$} (idf);
\draw[->] (idf) -- (cn);
\end{tikzpicture}
\end{document}
這個想法是為「內部」節點定義一種樣式;將節點放在鏈中,用一些標籤繪製箭頭,並使用fit
庫繪製外部矩形。
可以透過許多其他方式產生相同的圖表;例如,這次使用positioning
庫:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{positioning}
\begin{document}
\begin{tikzpicture}[
simple/.style={draw,text width=1.5cm,align=center,minimum size=2.5em},
node distance=12mm
]
\node (xn) {$x[n]$};
\node[simple,right = of xn] (dft) {DFT};
\node[simple,right = of dft] (log) {log};
\node[simple,right = of log] (idf) {IDFT};
\node[,right = of idf] (cn) {$c[n]$};
\draw[dashed] ([xshift=-12pt,yshift=12pt]dft.north west) rectangle ([xshift=12pt,yshift=-12pt]idf.south east) ;
\draw[->] (xn) -- (dft);
\draw[->] (dft) -- node[auto] {$X[k]$} (log);
\draw[->] (log) -- node[auto] {$\hat{X}[k]$} (idf);
\draw[->] (idf) -- (cn);
\end{tikzpicture}
\end{document}