Graphics, Figures & TablesDrawning a dashed box in Tikz

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
SDavid
Posts: 3
Joined: Thu Jul 21, 2011 8:27 pm

Drawning a dashed box in Tikz

Post by SDavid »

Hello all,

I have this piece of code that produces a part of figure I want, and I need to add to it to look like the hand-drawn figure attached.

Code: Select all

\documentclass{report}
\usepackage{tikz}
\usetikzlibrary{positioning}
\usetikzlibrary{shapes,arrows,fadings, shadows,calc}

\begin{document}
%%%%%%%%%%%%%%%%
\tikzstyle{sensor}=[draw, fill=gray!40, text width=5em, 
    text centered, minimum height=2.5em]
\tikzstyle{ann} = [above, text width=5em]
\tikzstyle{naveqs} = [sensor, text width=3em, fill=gray!40, 
    minimum height=4em, rounded corners, shade, drop shadow]
		
		\tikzstyle{naveqs1} = [sensor, text width=4em, fill=gray!40, 
    minimum height=4em, rounded corners, shade, drop shadow]
		%*************
		\tikzstyle{block} = [draw, fill=gray!40, rectangle, minimum height=3em, minimum width=4em, shade, rounded corners,drop shadow]
	\tikzstyle{sum} = [draw, top color=gray!40, circle, node distance=1cm, shade,drop shadow]
\tikzstyle{input} = [coordinate]
\tikzstyle{output} = [coordinate]
\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]

		%****************
\def\blockdist{2.3}
\def\edgedist{2.5}



\tikzstyle{pinstyle} = [pin edge={to-,thin,black}]


\begin{figure}
\begin{center}
\begin{tikzpicture}[thick,scale=0.7, every node/.style={scale=0.7}]
\node (input) [input,name=input_Signal] {};
\node (input) [input,name=input_Signal1,right of=input_Signal, node distance=1cm] {};
\node (input) [input,name=input_Signal2,above of=input_Signal1, node distance=2cm] {};
\node (sum) [sum, right of=input_Signal2, node distance=1cm] {X};
\node (input) [input,name=FrequencyShift,below of=sum,node distance=1cm] {};
\node [block, name=Resampling, right of=sum,node distance=1.5cm] (Resampling) {};
\node (naveq) [naveqs, name=S2P, right of=Resampling,node distance=2cm] {};
\node (Ch1) [sum, right of=S2P, node distance=2cm] {X};
\node (inputCh1) [input,name=FrequencyShiftCh1,below of=Ch1,node distance=1cm] {};
%\node (naveq) [naveqs, name=FFT, right of=S2P,node distance=3cm] {FFT};

\node (input) [input,name=input_Signal3,below of=input_Signal1, node distance=2cm] {};
\node (sum) [sum, name=sum2, right of=input_Signal3, node distance=1cm] {X};
\node (input) [input,name=FrequencyShift2,below of=sum2,node distance=1cm] {};
\node [block, name=Resampling2, right of=sum2, node distance=1.5cm] (Resampling2) {};
\node (naveq) [naveqs, name=S2P2, right of=Resampling2,node distance=2cm] {};
\node (Ch2) [sum, right of=S2P2, node distance=2cm] {X};
\node (inputCh2) [input,name=FrequencyShiftCh2,below of=Ch2,node distance=1cm] {};

\node (sum_11) [sum, right of=input_Signal, node distance=9cm] {$\Sigma$};

\node (output) [input,right of=sum_11,name=output_Signal,node distance=1cm] {};

		\draw [draw] (input_Signal) -- node[pos=-0.5] {$v(t)$} (input_Signal1);
		\draw [draw] (input_Signal1) -- node[pos=-0.5] {} (input_Signal2);
			\draw [draw,->] (input_Signal2) -- node[pos=-0.5] {} (sum);
		\draw [draw,->] (FrequencyShift) -- node[pos=-0.5] {} (sum);
		\draw [draw,->] (sum) -- node[] {} (Resampling);
		\draw [draw,->] (Resampling) -- node {} (S2P);
		\draw [draw,->] (S2P) -- node {} (Ch1);
		\draw [draw,->] (FrequencyShiftCh1) -- node[pos=-0.5] {} (Ch1);
		\draw [draw,->] (Ch1) -- node[pos=-0.5] {} (sum_11);
		\draw [draw,->] (sum_11) -- node [above]{} (output_Signal);
		
					\fill ($(input_Signal1)+(1,0)$) circle[radius=1pt] +(0,.2) circle[radius=1pt]  +(0,-0.2) circle[radius=1pt]; 
					\fill ($(input_Signal1)+(2.5,0)$) circle[radius=1pt] +(0,.2) circle[radius=1pt]  +(0,-0.2) circle[radius=1pt];
					\fill ($(input_Signal1)+(5,0)$) circle[radius=1pt] +(0,.2) circle[radius=1pt]  +(0,-0.2) circle[radius=1pt];
					\fill ($(input_Signal1)+(6.5,0)$) circle[radius=1pt] +(0,.2) circle[radius=1pt]  +(0,-0.2) circle[radius=1pt];
					
		\draw [draw] (input_Signal1) -- node[pos=-0.5] {} (input_Signal3);
			\draw [draw,->] (input_Signal3) -- node[pos=-0.5] {} (sum2);
		\draw [draw,->] (FrequencyShift2) -- node[pos=-0.5] {} (sum2);
		\draw [draw,->] (sum2) -- node[] {} (Resampling2);
		\draw [draw,->] (Resampling2) -- node {} (S2P2);
		\draw [draw,->] (S2P2) -- node {} (Ch2);
		\draw [draw,->] (FrequencyShiftCh2) -- node[pos=-0.5] {} (Ch2);
		\draw [draw,->] (Ch2) -- node[pos=-0.5] {} (sum_11);

\end{tikzpicture}
\end{center}
\end{figure}
\end{document}
Thanks in advance
Attachments
DOC.pdf
(47.34 KiB) Downloaded 582 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Drawning a dashed box in Tikz

Post by kaiserkarl13 »

Try adding these lines to the bottom:

Code: Select all

      \draw [dashed] (sum_11) ++(0.5,-3) rectangle ++(3.5,6);
      \draw (sum_11) ++(1,0) |- ++(1,1.5) -- ++(0,-1) rectangle ++(1,2);
      \draw (sum_11) ++(1,0) |- ++(1,-1.5) -- ++(0,-1) rectangle ++(1,2);
      \draw (sum_11) ++(2.25,3.5) node {Equalizer};
Post Reply