Debian Codegraph @

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

raw
1 .PS
2 # Loglog.m4
3 gen_init
4 s_init(Loglog)
5 sinclude(tst.dim)
6 scale = 1/0.8
7
8 define(`rint',`sign(`$1')*int(abs(`$1')+.5)')
9 S:[
10 horiz = 4
11 vert = horiz*2/3
12 tmax = 10
13 tmin = 1
14 vmax = 100
15 vmin = 0.1
16 tic = 0.08
17 denv = log(vmax) - log(vmin)
18 denh = log(tmax) - log(tmin)
19
20 Origin: Here
21 define(`coord',
22 `Origin+((log(`$1')-log(tmin))/denh*horiz,(log(`$2')-log(vmin))/denv*vert)')
23
24 thinlines_
25 # Left axes and labels
26 psset_(linecolor=gray)
27 vm = log(vmin); if vm!=0 then { vm=rint(vm) }
28 vM = log(vmax); if vM!=0 then { vM=rint(vM) }
29 for i = vm to vM do {
30 move to coord(tmin,exp(i))
31 line right horiz
32 s_box(\sf %g,exp(i)) rjust at last line.start ifgpic(`-(0.05,0)')
33 if i < rint(log(vmax)) then {
34 for j = 2 to 9 do {
35 move to coord(tmin,j*exp(i))
36 line right horiz
37 if (j==2) || (j==5) then {
38 s_box(\sf %g,j*exp(i)) rjust at last line.start ifgpic(`-(0.05,0)') }
39 } } }
40
41 #Horizontal axis and labels
42 tm = log(tmin); if tm!=0 then { tm=rint(tm) }
43 tM = log(tmax); if tM!=0 then { tM=rint(tM) }
44 for t = tm to tM do {
45 move to coord(exp(t),vmin)
46 line up vert
47 s_box(\sf %g,exp(t)) below at last line.start ifgpic(`-(0,0.05)')
48 if t < rint(log(tmax)) then {
49 for j = 2 to 9 do { move to coord(j*exp(t),vmin)
50 line up vert
51 if (j==2) || (j==5) then {
52 s_box(\sf %g,j*exp(t)) below at last line.start ifgpic(`-(0,0.05)') }
53 } } }
54 psset_(linecolor=black)
55
56 # arrow from Origin up vert chop 0 chop -.1
57 line from Origin up vert
58 s_box($y(t)$) at Origin+(-.1,.5*vert) rjust
59
60 # arrow from Origin right horiz chop 0 chop -.1
61 line from Origin right horiz
62 s_box($t$) at Origin+(.5*horiz,-.1) below
63
64 thicklines_
65 alpha = 2.5
66 beta = 3.0
67 tm = max(tmin,(vmin/alpha)^(1/beta))
68 tM = min(tmax,(vmax/alpha)^(1/beta))
69 line from coord(tm,alpha*tm^beta) to coord(tM,alpha*tM^beta)
70 f_box(invis fill_(1),`$y(t) = %g\,t^{%g}$',alpha,beta) \
71 with .sw at coord(2.1,11)
72
73 alpha = 0.05
74 beta = 2.0
75 tm = max(tmin,(vmin/alpha)^(1/beta))
76 tM = min(tmax,(vmax/alpha)^(1/beta))
77 line from coord(tm,alpha*tm^beta) to coord(tM,alpha*tM^beta)
78 f_box(invis fill_(1),`$y(t) = %g\,t^{%g}$',alpha,beta) \
79 with .se at coord(4.6,1.1)
80
81 ]
82
83 #.PE
84 #.PS
85 # ex06.m4
86 #gen_init
87
88 [
89 F: box invis wid 1.6i ht 1.8i
90 E: box invis wid F.wid ht F.ht
91 G: box invis wid 1i ht F.ht
92
93 ell = F.ht-0.6i
94 r = 0.3i
95 offset = 8bp__
96 pitch = 0.1i
97 dhs = pitch * sqrt(2)
98 qmell = F.ht - ell
99 kwid = F.wid-qmell-r
100
101 hatchbox(wid G.e.x-F.w.x ht F.ht,pitch) with .sw at F.sw
102 box invis fill_(1) ht ell wid E.e.x-F.w.x with .nw at F.nw
103
104 box wid G.e.x-F.w.x ht F.ht with .sw at F.sw thick linethick*3/2
105 foreach_(`B',
106 `B`'T: B.se + (-qmell,qmell)
107 line invis fill_(1) from B.se to (B.se,B`'T) then to B`'T then to B.se
108 line from (B.w,B`'T) to B`'T chop 0 chop -offset
109 line from B`'T up ell chop -offset chop 0
110 line from B`'T + (-r,0) up ell
111 line dashed from B`'T to B.se
112 "\large $0$" at B`'T + (-r/2,ell/2)
113 "\large $0$" at B`'T + (qmell/2,ell/2)
114 "$t$" at (B`'T,B.n) + (-offset/2,offset)
115 sprintf("$\overbrace{\phantom{\hbox to %gin{}}}^{\hbox{$k$}}$",kwid/scale) \
116 at B.nw + (kwid/2,0) above
117 hatchbox(wid kwid ht ell,pitch,,90) with .nw at B.nw
118 line from B.ne to B.se thick linethick*3/2
119 ',F,E)
120
121 line from (G.w,ET) right G.wid
122 line from ET + (0,r) left ET.x-E.w.x
123 hatchbox(wid r ht r,pitch,,0) with .se at ET
124
125 "$q$" at F.sw + (-offset,offset/3)
126 "$\ell$" at (F.w,FT) + (-offset,offset/3)
127
128 "$n{+}p{+}m$" at G.ne + (0,offset)
129
130 foreach_(`B',`"\Large $B$" ht 0.2 with .n at B.s + (0,-offset/2)',F,E,G)
131
132 # extra left brace to avoid a psfrag problem (bug?)
133 sprintf(\
134 "$\vphantom{\{}\left.\vrule height %gin depth0pt width0pt\right\}r$",\
135 r/2*0.9) at ET + (offset,r/2)
136
137 # Adjust the bounding box without using s_box:
138 # move from F.nw+(-12bp__,21bp__) to G.se+(20bp__,-15bp__)
139 ] with .sw at last [].se+(0.15,0)
140 .PE