diff options
author | Karl Berry <karl@freefriends.org> | 2014-07-25 21:05:22 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-07-25 21:05:22 +0000 |
commit | 2aa608cd9808e84c462362be9eb92a98a1b79e4d (patch) | |
tree | a2b6a17091695597883f496158d73b85c18ab32f /Master/texmf-dist/tex/latex/dsptricks/dspblocks.sty | |
parent | 43255aab4df3eb4f9d71e5f80e9bab45f8bdad72 (diff) |
dsptricks (25jul14)
git-svn-id: svn://tug.org/texlive/trunk@34724 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/dsptricks/dspblocks.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/dsptricks/dspblocks.sty | 116 |
1 files changed, 116 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/dsptricks/dspblocks.sty b/Master/texmf-dist/tex/latex/dsptricks/dspblocks.sty new file mode 100644 index 00000000000..b7aba995a9e --- /dev/null +++ b/Master/texmf-dist/tex/latex/dsptricks/dspblocks.sty @@ -0,0 +1,116 @@ +%% This is the package dspblocks +%% +%% (c) Paolo Prandoni <paolo.prandoni _at_ epfl.ch> +%% +%% This program can be redistributed and/or modified under the terms +%% of the LaTeX Project Public License Distributed from CTAN archives +%% in directory macros/latex/base/lppl.txt. +%% +%% DESCRIPTION: +%% `dspblocks' is a companion package to dsptricks; it contains a +%% set of macros to draw the types of block diagrams commonly +%% used in DSP theory +%% +%% v1.0, July 2014 +%% + +% required packages: +\RequirePackage{calc} +\RequirePackage{fp} +\RequirePackage{pst-xkey} +\RequirePackage{fmtcount} +\RequirePackage{ifthen} +% +\ProvidesPackage{dspblocks}[2014/07/24 package for signal processing graphics] + + +% 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{-14.6pt}{ + \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]{ + \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
\ No newline at end of file |