1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
|
%%
%% This is file `pst-osci.tex',
%%
%% IMPORTANT NOTICE:
%%
%% Package `pst-osci.tex'
%%
%% Authors : Manuel LUQUE <Mluque5130@aol.com>
%% Christophe JORSSEN <Christophe.Jorssen@free.fr>
%%
%% 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:
%% `pst-osci' is a PSTricks package to plot oscilloscope diagrams
%%
%% AllColor=false (true par défaut) Raoul HATTERER<Hatterer.Raoul@wanadoo.fr>
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
\csname PSTOscilloLoaded\endcsname
\let\PSTOscilloLoaded\endinput
%
% Require PSTricks, pstcol,pstplot and multido packages
\ifx\PSTplotLoaded\endinput\else\input pst-plot.tex\fi
\ifx\MultidoLoaded\endinput\else\input multido.tex\fi
\ifx\PSTXKeyLoaded\endinput\else\input pst-xkey \fi % hv
\def\fileversion{2.82}% modifié
\def\filedate{2005/10/17}
\message{`PST-osci' v\fileversion, \filedate\space (ML/CJ)}
%%Last mod. by : Raoul HATTERER 2003/11/02
%%Last mod. by : Herbert Voss 2005/11/07
%
\edef\PstAtCode{\the\catcode`\@} \catcode`\@=11\relax
\pst@addfams{pst-osci}
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\font\ssf=cmss10
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newrgbcolor{Beige}{0.96 0.96 0.86}
\newrgbcolor{LightGray}{0.8 0.8 0.8}
\newrgbcolor{VeryLightGray}{0.9 0.9 0.9}
\newcmykcolor{PaleOrange}{0 0.2 0.4 0}
\newcmykcolor{LightBlue}{0.1 0 0 0}
\newrgbcolor{ACredA}{1 0 0}
\newrgbcolor{ACgreenA}{0 1 0}
\newrgbcolor{ACmagentaA}{1 0 1}
\newrgbcolor{ACred}{0 0 0}
\newrgbcolor{ACgreen}{.25 .25 .25}% green or Darkgray
\newrgbcolor{ACmagenta}{0 0 0}% magenta or black
%
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\define@key[psset]{pst-osci}{period1}{\edef\psk@Oscillo@PeriodA{#1}}
\define@key[psset]{pst-osci}{period2}{\edef\psk@Oscillo@PeriodB{#1}}
\define@key[psset]{pst-osci}{periodmodulation1}{\edef\psk@Oscillo@PeriodModulationA{#1}}
\define@key[psset]{pst-osci}{freqmod1}{\edef\psk@Oscillo@FreqModA{#1}}
\define@key[psset]{pst-osci}{periodmodulation2}{\edef\psk@Oscillo@PeriodModulationB{#1}}
\define@key[psset]{pst-osci}{freqmod2}{\edef\psk@Oscillo@FreqModB{#1}}
\define@key[psset]{pst-osci}{amplitude1}{\edef\psk@Oscillo@AmplitudeA{#1}}
\define@key[psset]{pst-osci}{amplitude2}{\edef\psk@Oscillo@AmplitudeB{#1}}
\define@key[psset]{pst-osci}{CC1}{\edef\psk@Oscillo@ContinuousComponentA{#1}}
\define@key[psset]{pst-osci}{CC2}{\edef\psk@Oscillo@ContinuousComponentB{#1}}
\define@key[psset]{pst-osci}{timediv}{\edef\psk@Oscillo@TimeDiv{#1}}
\define@key[psset]{pst-osci}{phase1}{\edef\psk@Oscillo@PhaseA{#1}}
\define@key[psset]{pst-osci}{phase2}{\edef\psk@Oscillo@PhaseB{#1}}
\define@key[psset]{pst-osci}{sensivity1}{\edef\psk@ChannelA{#1}}
\define@key[psset]{pst-osci}{sensivity2}{\edef\psk@ChannelB{#1}}
\define@key[psset]{pst-osci}{damping1}{\edef\psk@Oscillo@dampingA{#1}}
\define@key[psset]{pst-osci}{damping2}{\edef\psk@Oscillo@dampingB{#1}}
\define@key[psset]{pst-osci}{Fourier}{\edef\psk@Oscillo@Fourier{#1}}
\define@key[psset]{pst-osci}{offset1}{\edef\psk@Oscillo@OffsetA{#1}}
\define@key[psset]{pst-osci}{offset2}{\edef\psk@Oscillo@OffsetB{#1}}
\define@key[psset]{pst-osci}{offset3}{\edef\psk@Oscillo@OffsetC{#1}}
\define@key[psset]{pst-osci}{plotstyle1}{\edef\psk@Oscillo@PlotStyleA{#1}}
\define@key[psset]{pst-osci}{plotstyle2}{\edef\psk@Oscillo@PlotStyleB{#1}}
\define@key[psset]{pst-osci}{plotstyle3}{\edef\psk@Oscillo@PlotStyleC{#1}}
\define@key[psset]{pst-osci}{plotstyle4}{\edef\psk@Oscillo@PlotStyleD{#1}}
\define@key[psset]{pst-osci}{operation}{%
\def\@tempa{#1}%
\let\psk@Oscillo@Operation\@tempa}
\define@key[psset]{pst-osci}{Wave1}{%
\def\@tempa{#1}%
\let\psk@Oscillo@WaveA\@tempa}
\define@key[psset]{pst-osci}{Wave2}{%
\def\@tempa{#1}%
\let\psk@Oscillo@WaveB\@tempa}
\newif\ifPst@Oscillo@Lissajous
\define@key[psset]{pst-osci}{Lissajous}[true]{\@nameuse{Pst@Oscillo@Lissajous#1}}
\newif\ifPst@Oscillo@AllColor
\define@key[psset]{pst-osci}{AllColor}[true]{\@nameuse{Pst@Oscillo@AllColor#1}}
\newif\ifPst@Oscillo@Combine
\define@key[psset]{pst-osci}{combine}[true]{\@nameuse{Pst@Oscillo@Combine#1}}
%
\psset{period1=20,period2=20,amplitude1=2,amplitude2=0,%
phase1=0,phase2=0,timediv=5,Lissajous=false,AllColor=true,sensivity1=1,%
sensivity2=1,damping1=0,damping2=0,combine=false,%
offset1=0,offset2=0,plotstyle1=GreenContA,Fourier=100,%
plotstyle2=BlueContB,plotstyle3=RedContLissajou,%
plotstyle4=MagentaContAddSub,operation=\relax,Wave1=\SinusA,Wave2=\SinusB,%
periodmodulation1=100,freqmod1=0,periodmodulation2=100,%
freqmod2=0,CC1=0,CC2=0,offset3=0}
%
\newpsstyle{GreenContA}{linecolor=green,linewidth=0.05,plotpoints=360}
\newpsstyle{BlackContA}{linecolor=black,%AllColor
linewidth=0.05,plotpoints=360}
\newpsstyle{BlueContB}{linecolor=blue,linewidth=0.05,plotpoints=360}
\newgray{darkgray}{.25}
\newpsstyle{DarkgrayContB}{linecolor=darkgray,%AllColor
linewidth=0.06,plotpoints=360}
\newpsstyle{RedContLissajou}{linecolor=red,linewidth=0.05,plotpoints=1000}
\newpsstyle{BlackContLissajou}{linecolor=black,%AllColor
linewidth=0.06,plotpoints=1000}
\newpsstyle{MagentaContAddSub}{linecolor=magenta,linewidth=0.05,plotpoints=1000}
\newgray{gray}{.5}
\newpsstyle{DarkgrayDashAddSub}{linestyle=dashed,linecolor=darkgray,%AllColor
linewidth=0.06,plotpoints=1000}
\def\TriangleA{%
/Cste 0.4050284 def % 4/pi^2
/A1 \psk@Oscillo@AmplitudeA\space 2 mul def % Amplitude peak to peak
0 1 2 fourier{
/n exch def
t 10 mul T1 div BT mul
n mul cos
n n mul div Cste mul A1 mul add
}for e t AR1 mul neg exp mul SA div CC1 add}
\def\TriangleB{%
/Cste 0.4050284 def % 4/pi^2
/A2 \psk@Oscillo@AmplitudeB\space 2 mul def
0 1 2 fourier{
/n exch def
t 10 mul T2 div BT mul
n mul cos
n n mul div Cste mul A2 mul add
}for e t AR2 mul neg exp mul SB div CC2 add}
\def\RectangleA{
/Cste 0.6366 def
/A1 \psk@Oscillo@AmplitudeA\space 2 mul def
0 1 2 fourier{ %
/n exch def
t 10 mul T1 div BT mul
n mul sin
n div Cste mul A1 mul add %
}for
e t AR1 mul neg exp mul SA div CC1 add}
\def\RectangleB{
/Cste 0.6366 def
/A2 \psk@Oscillo@AmplitudeB\space 2 mul def
0 1 2 fourier{ %
/n exch def
t 10 mul T2 div BT mul
n mul sin
n div Cste mul A2 mul add %
}for
e t AR2 mul neg exp mul SB div CC2 add}
\def\RDogToothA{
/Cste 0.6366 def /timediv 5 def
0 1 1 fourier{ %
/n exch def
t 10 mul T1 div BT mul
n mul sin
n div -1 1 n add exp mul Cste mul A1 mul add%
}for
e t AR1 mul neg exp mul SA div CC1 add}
\def\RDogToothB{
/Cste 0.6366 def /timediv 5 def
0 1 1 fourier{%
/n exch def
t 10 mul T2 div BT mul
n mul sin
n div -1 1 n add exp mul Cste mul A2 mul add%
}for
SB div CC2 add}
\def\LDogToothA{
/Cste 0.6366 def /timediv 5 def t
0 1 1 fourier{%
/n exch def
t 10 mul T1 div BT mul
n mul sin
n div 180 n mul cos mul Cste mul A1 mul add%
}for
e t AR1 mul neg exp mul SA div CC1 add}
\def\LDogToothB{
/Cste 0.6366 def /timediv 5 def
0 1 1 fourier{%
/n exch def
t 10 mul T2 div BT mul
n mul sin
n div 180 n mul cos mul Cste mul A2 mul add%
}for
e t AR2 mul neg exp mul SB div CC2 add}
\def\SinusA{%
t 10 mul T1 div BT mul
mod1 57.3 mul t 10 mul Tm1 div BT mul sin mul add
phaseA add sin A1 mul
e t AR1 mul neg exp mul SA div CC1 add}
\def\SinusB{%
t 10 mul T2 div BT mul
mod2 57.3 mul t 10 mul Tm2 div BT mul sin mul
add phaseB add sin A2 mul
e t AR2 mul neg exp mul SB div CC2 add}
\def\Oscillo{\@ifnextchar[\Oscillo@i{\Oscillo@i[]}}
\def\Oscillo@i[#1]{%
\begingroup
\def\pst@par{#1}\ifx\pst@par\@empty\else\psset{#1}\fi
\pst@killglue
\ifPst@Oscillo@AllColor
\psset{plotstyle1=GreenContA,plotstyle2=BlueContB,%
plotstyle3=RedContLissajou,plotstyle4=MagentaContAddSub}
\else
\psset{plotstyle1=BlackContA,plotstyle2=DarkgrayContB,%
plotstyle3=BlackContLissajou,plotstyle4=DarkgrayDashAddSub}
\fi
\ifx\pst@par\@empty\else\psset{#1}\fi
\pspicture(0,-5)(10,5)
\psframe*[linecolor=LightBlue](0,-4)(10,4)
\psgrid[gridlabels=0,subgriddiv=0](0,-4)(10,4)
\multido{\nxDiv=0+0.2}{50}{%
\psline(\nxDiv,-.1)(\nxDiv,0.1)}
\multido{\nyDiv=-4.0+0.2}{40}{%
\psline(4.9,\nyDiv)(5.1,\nyDiv)}
\psframe[fillcolor=VeryLightGray,fillstyle=solid,dimen=middle](0,4)(10,5)
\rput(1.5,4.8){\ssf timeDiv :} \rput(1.5,4.3){\ssf\psk@Oscillo@TimeDiv{}ms/div}
\rput(4,4.8){\ssf Channel A :} \rput(4,4.3){\ssf\psk@ChannelA{} V/div}
\rput(7,4.8){\ssf Channel B :} \rput(7,4.3){\ssf\psk@ChannelB{} V/div}
\rput(9,4.8){\ssf XY}
\rput(9,4.3){\ifPst@Oscillo@Lissajous
\ifPst@Oscillo@AllColor\ACredA\else\ACred\fi ON
\else\ifPst@Oscillo@AllColor\ACgreenA\else\ACgreen\fi OFF\fi}%AllColor
\psframe[fillcolor=VeryLightGray,fillstyle=solid,dimen=middle](0,-5)(10,-4)
\ifPst@Oscillo@Combine
\rput(2,-4.3){\ssf\psk@Oscillo@Operation:}
\rput(2,-4.8){\ssf\ifPst@Oscillo@AllColor\ACmagentaA\else\ACmagenta\fi ON}%AllColor
\fi
\rput(6.5,-4.3){\ssf OffsetB}
\rput(6.5,-4.8){\ssf \psk@Oscillo@OffsetB}
\rput(8.5,-4.3){\ssf OffsetC}
\rput(8.5,-4.8){\ssf \psk@Oscillo@OffsetC}
\rput(4.5,-4.3){\ssf OffsetA}
\rput(4.5,-4.8){\ssf \psk@Oscillo@OffsetA}
\ifPst@Oscillo@Lissajous
\psclip{\psframe(0,-4)(10,4)}
\parametricplot[style=\psk@Oscillo@PlotStyleC]{0}{360}{%
/fourier \psk@Oscillo@Fourier\space def
/T1 \psk@Oscillo@PeriodA\space def
/T2 \psk@Oscillo@PeriodB\space def
/Tm1 \psk@Oscillo@PeriodModulationA\space def
/mod1 \psk@Oscillo@FreqModA\space def
/Tm2 \psk@Oscillo@PeriodModulationB\space def
/mod2 \psk@Oscillo@FreqModB\space def
/CC1 \psk@Oscillo@ContinuousComponentA\space def
/CC2 \psk@Oscillo@ContinuousComponentB\space def
/BT T1 def
/A1 \psk@Oscillo@AmplitudeA\space def
/A2 \psk@Oscillo@AmplitudeB\space def
/phaseA \psk@Oscillo@PhaseA\space def
/phaseB \psk@Oscillo@PhaseB\space def
%/K 36 T div def
/e 2.718 def
/AR1 \psk@Oscillo@dampingA\space def
/AR2 \psk@Oscillo@dampingB\space def
/SA \psk@ChannelA\space def
/SB \psk@ChannelB\space def
/offset1 \psk@Oscillo@OffsetA\space def
/offset2 \psk@Oscillo@OffsetB\space def
\psk@Oscillo@WaveA\space 5 add
\psk@Oscillo@WaveB\space}
\endpsclip
\else
\psclip{\psframe(0,-4)(10,4)}\psset{xunit=0.02777}
\parametricplot[style=\psk@Oscillo@PlotStyleA]{0}{360}{%
/fourier \psk@Oscillo@Fourier\space def
/T1 \psk@Oscillo@PeriodA\space def
/Tm1 \psk@Oscillo@PeriodModulationA\space def
/mod1 \psk@Oscillo@FreqModA\space def
/BT \psk@Oscillo@TimeDiv\space def
/A1 \psk@Oscillo@AmplitudeA\space def
/phaseA \psk@Oscillo@PhaseA\space def
/CC1 \psk@Oscillo@ContinuousComponentA\space def
/e 2.718 def
/AR1 \psk@Oscillo@dampingA\space def
/offset1 \psk@Oscillo@OffsetA\space def
/SA \psk@ChannelA\space def
t \psk@Oscillo@WaveA\space
offset1 add
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\parametricplot[style=\psk@Oscillo@PlotStyleB]{0}{360}{%
/fourier \psk@Oscillo@Fourier\space def
/T2 \psk@Oscillo@PeriodB\space def
/Tm2 \psk@Oscillo@PeriodModulationB\space def
/mod2 \psk@Oscillo@FreqModB\space def
/BT \psk@Oscillo@TimeDiv\space def
/A2 \psk@Oscillo@AmplitudeB\space def
/phaseB \psk@Oscillo@PhaseB\space def
/CC2 \psk@Oscillo@ContinuousComponentB\space def
/e 2.718 def
/AR2 \psk@Oscillo@dampingB\space def
/offset2 \psk@Oscillo@OffsetB\space def
/SB \psk@ChannelB\space def
t \psk@Oscillo@WaveB\space
offset2 add
}
\ifPst@Oscillo@Combine
%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\parametricplot[style=\psk@Oscillo@PlotStyleD]{0}{360}{%
/fourier \psk@Oscillo@Fourier\space def
/T1 \psk@Oscillo@PeriodA\space def
/T2 \psk@Oscillo@PeriodB\space def
/Tm1 \psk@Oscillo@PeriodModulationA\space def
/mod1 \psk@Oscillo@FreqModA\space def
/Tm2 \psk@Oscillo@PeriodModulationB\space def
/mod2 \psk@Oscillo@FreqModB\space def
/BT \psk@Oscillo@TimeDiv\space def
/A1 \psk@Oscillo@AmplitudeA\space def
/A2 \psk@Oscillo@AmplitudeB\space def
/phaseA \psk@Oscillo@PhaseA\space def
/phaseB \psk@Oscillo@PhaseB\space def
/CC1 \psk@Oscillo@ContinuousComponentA\space def
/CC2 \psk@Oscillo@ContinuousComponentB\space def
/offset3 \psk@Oscillo@OffsetC\space def
/e 2.718 def
/AR1 \psk@Oscillo@dampingA\space def
/AR2 \psk@Oscillo@dampingB\space def
/SA \psk@ChannelA\space def
/SB \psk@ChannelB\space def
/offset1 \psk@Oscillo@OffsetA\space def
/offset2 \psk@Oscillo@OffsetB\space def
t \psk@Oscillo@WaveA\space
\psk@Oscillo@WaveB\space
\psk@Oscillo@Operation%
\space offset3 add}
\fi
\endpsclip\fi
\endpspicture%
\endgroup\ignorespaces}
\catcode`\@=\PstAtCode\relax
\endinput
|