[Tex/LaTex] Simple Draw in Latex

formattinggraphics

Hi I want to draw this simple figure in latex
Simple Draw
can anyone please help me?

Best Answer

Here's one possibility, using TikZ and chains:

\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}

enter image description here

The idea is to define a style for the "inner" nodes; place the nodes in a chain, draw the arrows with some labels and draw the outer rectangle using the fit library.

The same diagram could have been produced in many other ways; for example, using this time the positioning library:

\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}
Related Question