Page MenuHomec4science

dspBlocks.sty
No OneTemporary

File Metadata

Created
Thu, Mar 13, 08:55

dspBlocks.sty

\typeout{ }
\typeout{by Paolo Prandoni, 2012 }
\typeout{contact: paolo.prandoni@epfl.ch}
\typeout{ }
% required packages:
\usepackage{calc}
\usepackage{fp}
\usepackage{pst-xkey}
\usepackage{fmtcount}
\usepackage{ifthen}
% turn off FP messages
\FPmessagesfalse
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
%% Set up BLOCK DIAGRAM plot
%
% \begin{psdrawBDmatrix}[OPTIONS]{X_SPACING}{Y_SPACING}
%
% X_SPACING
% Y_SPACING vertical and horizontal spacing
%
% Once in Block diagram mode the following commands are available
% (they all create nodes)
%
% \BDadd adder
% \BDmul multiplier
% \BDdelay z^{-1} delay block
% \BDdelayN{N} z^{-N} delay block
% \BDfilter{text} filter box
% \BDfilterMulti{text} multiline filter box
% \BDsplit splitting point (dot)
% \BDupsmp{K} upsampler by K
% \BDdwsmp{K} downsampler by K
%
\def\BDwidth{1.2pt}
\psset{xunit=1mm,yunit=1mm,linewidth=\BDwidth}
\def\BDadd{[mnode=circle] +}%
\def\BDsub{[mnode=circle] -}%
\def\BDmul{[mnode=circle] $\times$}%
\def\BDdelay{\psframebox[framesep=.3]{$z^{-1}$}}%
\def\BDdelayN#1{\psframebox[framesep=.3]{$z^{-#1}$}}%
\def\BDfilter#1{\psframebox[framesep=.3]{#1}}%
\def\BDfilterMulti#1{\psframebox%
{\begin{tabular}{c} #1 \end{tabular}}}%
\def\BDsplit{[mnode=dot,linewidth=1.5pt]}%
\def\BDupsmp#1{[mnode=circle] $#1 \uparrow$}%
\def\BDdwsmp#1{[mnode=circle] $#1 \downarrow$}%
\def\BDsampler{\raisebox{-16.2pt}{
\psset{xunit=1em,yunit=1em,linewidth=1.2pt}%
\pspicture(-2.6,-1.8)(1,1.8)%
\psline(-3,0)(-1.6,0)(0.7,1.2)
\psline(0.8,0)(1,0)
\psarc[linewidth=1pt]{<-}(-1.2,0){1.4em}{-10}{55}
\endpspicture}}
\newcommand{\BDsamplerFramed}[1][1em]{%BDsamplerFramed{\raisebox{-1.4em}{\psframebox[linewidth=1.5pt]{%
\newskip\tmpLen \tmpLen=#1%
\raisebox{-1.5\tmpLen}{%
\psframebox[linewidth=1.2pt]{%
\psset{unit=#1,linearc=0}%
\pspicture(-3.1,-2)(3,2)%
\psline(-2.8,-0.2)(-1.6,-0.2)(1.2,1.4)%
\psline(1.1,-0.2)(1.8,-0.2)%
\psarc[linewidth=1pt]{<-}(-1.6,0){2}{-10}{55}%
\endpspicture}}}
\newcommand{\BDlowpass}[1][1em]{%
\newskip\tmpLen \tmpLen=#1%
\raisebox{-1.5\tmpLen}{%
\psframebox[linewidth=1.2pt]{%
\psset{unit=#1,linearc=0}%
\pspicture(-3.1,-2)(3,2)%
\psline{->}(-2.8,-1)(2.8,-1)%
\psline{->}(0,-1.8)(0,2)%
\psline[linewidth=1.5pt](-1,-1)(-1,0.8)(1,0.8)(1,-1)%
\endpspicture}}}
\newcommand{\BDsinc}[1][1em]{%
\newskip\tmpLen \tmpLen=#1%
\raisebox{-1.5\tmpLen}{%
\psframebox[linewidth=1.2pt]{%
\psset{unit=#1,linearc=0}%
\pspicture(-3.1,-2)(3,2)%
\psline{->}(-2.8,-.5)(2.8,-.5)%
\psline{->}(0,-1.8)(0,2)%
\psplot[linewidth=1pt, plotpoints=500,linejoin=1]{-2.5}{2.5}{x \dspSinc{0}{0.5} 1.5 mul .5 sub}%
\endpspicture}}}
\newenvironment{dspBlocks}[2]{%
\begin{psmatrix}[colsep=#1,rowsep=#2,emnode=R] }{%
\end{psmatrix}
}
\newcommand{\BDConnH}[5][]{\ncline[#1]{->}{#2,#3}{#2,#4}\taput{#5}}
\newcommand{\BDConnHNext}[2]{\FPupn\n{#2 1 add 0 trunc}\ncline{->}{#1,#2}{#1,\n}}
\newcommand{\BDConnV}[5][]{\ncline[#1]{->}{#2,#3}{#4,#3}\tlput{#5}}
\makeatother

Event Timeline