Debian Codegraph @

texmf-dist/doc/latex/circuit-macros/examples/sfg.m4

raw
1 .PS
2 # sfg.m4
3 sfg_init( 1.2 ) # default edge length = 1.2
4
5 iflatex(`textoffset = 1bp__; ifpsfrag(`textht = 9.5bp__',
6 `latexcommand({\small)') ')
7
8 [
9 # Graph 1
10 T:[
11 Ft: sfgnode(,f(t),sfgbelow,shaded "red")
12 sfgline(,1/K)
13 Y1: sfgnode(,y_1,sfgbelow rjust)
14 sfgline(,K/M)
15 DDY2: sfgnode(,\ddot{y}_2,sfgbelow rjust)
16 sfgline(,s^{-1})
17 DY2: sfgnode(,\d`'ot{y}_2=x_2,sfgbelow ljust) dnl dot is an m4 macro
18 sfgline(,s^{-1})
19 Y2: sfgnode(,y_2=x_1,sfgbelow ljust,shaded "green")
20
21 sf = 1
22 sfgarc(from DY2 to DDY2,-B/M,below,,sf,outlined "gray")
23 sfgarc(from Y2 to DDY2,-K/M,above,ccw,sf,outlined "gray")
24 sfgarc(from Y2 to Y1,1,sfgabove,,sf,outlined "gray")
25 ]
26 #showbox_(,"T")
27
28 # Graph 2
29 B: [
30 R1: sfgnode(,r_1,sfgabove)
31 sfgline(,1)
32 X1: sfgnode(,\;x_1,ljust)
33 R2: sfgnode(at R1+(0,-1),r_2,sfgabove)
34 sfgline(,1)
35 X2: sfgnode(,\;x_2,ljust)
36 sfgarc(from X1 to X2,a_{21}\;,rjust,ccw)
37 sfgarc(from X2 to X1,\;a_{12},ljust,ccw)
38
39 sfgself(at X1,,q_{11})
40 sfgself(at X1,R,\;a_{11},ljust,cw,1.5)
41 sfgself(at X2,-90,a_{22},sfgbelow)
42 ] with .w at T.e + (linewid/2,-linewid/4)
43 #showbox_(,"B")
44
45 # Graph 3
46 G3: [#sfg_init( 0.85,0.35/2 ) # change node spacing and size
47 sfg_wid = 0.85
48 sfg_rad = 0.35/2
49 NeedDpicTools
50 cmyktorgb(96,0,0,0,r,g,b)
51 for_(1,4,1,`N`'m4x: ColoredV(circle,(r,g,b),"m4x" rad sfg_rad)
52 sfgself(at N`'m4x,-90,P_{m4x},,cw)
53 ifelse(m4x,4,,`sfgline(,G_{m4x},sfgbelow)') ')
54 sfgarc(from N2 to N1,F_2,sfgabove,ccw,)
55 sfgarc(from N3 to N1,F_3,sfgbelow,ccw,1.4)
56 ] with .nw at T.sw
57 #showbox_(,"G3")
58
59 A: [#sfg_init( 0.75,0.15 )
60 sfg_wid = 0.75
61 sfg_rad = 0.15
62 arrow right linewid*2/3
63 P: sfgnode(,p)
64 sfgself(,90,a,sfgbelow,cw)
65 arrow from P.e "b" below
66 Q: sfgnode(,q)
67 R: sfgnode(at Q+(Q.x-P.x,Q.y-P.y),r) # for gpic
68 sfgarc(from Q to R,c,sfgabove,cw)
69 sfgarc(from R to Q,d,sfgbelow,cw)
70 sfgself(at R,-90,e,sfgabove,cw)
71 arrow right linewid*2/3 from R.e
72 ] with .w at G3.e+(linewid/2,0)
73 #showbox_(,"A")
74
75 G4: [sfg_init( 2.0,0.25/2 ) # change node spacing and size
76 s1 = 0.9
77 s2 = 1.2
78 N0: sfgnode(,\hbox{\Large 0},,invis)
79 sfgline(right_ sfg_wid,\nu,below,->)
80 N1: sfgnode(,\hbox{\Large 1},,invis)
81 { sfgarc(to N0 ->,(1{-}p)\gamma{+}\nu,above,ccw,s1) }
82 sfgline(right_ sfg_wid,\nu+\lambda,below,->)
83 N2: sfgnode(,\hbox{\Large 2},,invis)
84 { sfgarc(to N1 ->,{{2}\choose{1}}p(1{-}p)\gamma{+}2\nu,above,ccw,s1) }
85 { sfgarc(to N0 ->,(1{-}p)^2\gamma,above,ccw,s2) }
86 sfgline(right_ sfg_wid,\nu+2\lambda,below,->)
87 N3: sfgnode(,\hbox{\Large 3},,invis)
88 { sfgarc(to N2 ->,{{3}\choose{2}}p^2(1{-}p)\gamma{+}3\nu,above,ccw,s1) }
89 { sfgarc(to N1 ->,{{3}\choose{1}}p(1{-}p)^2\gamma,above,ccw,1.2) }
90 { sfgarc(to N0 ->,(1{-}p)^3\gamma,above,ccw,s2) }
91 sfgline(right_ sfg_wid/2,\nu+3\lambda,below,->)
92 {"$\ldots$" wid 0.3 ljust}
93 ] with .nw at G3.sw+(0,-0.15)
94 #showbox_(,"G4")
95
96 # https://tex.stackexchange.com/questions/637455/tikz-how-to-set-exact-position-of-node
97 G5: [sfg_init( 1.75,0.25/2 ) # change node spacing and size
98 Dstar: sfgnode(,*,,shaded "green")
99 D0: sfgnode(at Dstar+(2,0),\diamond_0,,shaded "green")
100 sfgline(,`1-r_{x{-}1,x}-q^i_{x{-}1,x}',,->)
101 Ddots: sfgnode(,\cdots,,shaded "green")
102 sfgline(,`1-r_{x{-}4,x}-q^i_{x{-}4,x}',,->)
103 D5: sfgnode(,\diamond_5,,shaded "green")
104 DD: sfgnode(at D0+(0,-1.0),\dagger,,shaded "green")
105 sfgself(at Dstar,L,,,,0.5)
106 "$`1-i_x-q^a_x'$" wid 45bp__ at Dstar + (-0.3,0.25)
107 sfgself(at DD,D,1\mathstrut,above_,,0.5)
108 sfgself(at D5,R,,,,0.5)
109 "$`1-q^i_x-r_x'$" wid 47bp__ at D5 + (0.3,0.25)
110 sfgarc(from D0 to Dstar ->,`r_{x,x}\mathstrut',below_,ccw)
111 sfgarc(from Dstar to D0 ->,`i_x\mathstrut',above_,ccw)
112 sfgarc(from Dstar to DD ->,`q^a_x\mathstrut',above_ ljust_,ccw)
113 sfgline(from D0 to DD,`\;q^i_{x,x}',ljust,->)
114 sfgarc(from Ddots to Dstar,`r_{j,x}\mathstrut',below_,ccw,,->)
115 sfgarc(from Ddots to DD ->,`q^i_{x{-}j,x}\mathstrut',above_ rjust_,)
116 sfgarc(from D5 to Dstar ->,`r_x\mathstrut',below_,ccw)
117 sfgarc(from D5 to DD ->,`q^i_x\mathstrut',above_ rjust_,)
118 ] with .nw at G4.sw+(0,-0.15)
119 #howbox_(,"G5")
120
121 move from (T.w,G4.s)-(7bp__,6bp__) to B.ne+(15bp__,6bp__)
122 ]
123 #showbox_
124
125 iflatex(ifpsfrag(,`latexcommand(})'))
126 .PE