diff options
author | Francois Delebecque <Francois.Delebecque@inria.fr> | 2004-09-23 12:52:52 +0000 |
---|---|---|
committer | Francois Delebecque <Francois.Delebecque@inria.fr> | 2004-09-23 12:52:52 +0000 |
commit | a0d9d653d9b36ed1c84402ea7d0a60dea9424622 (patch) | |
tree | 7d11cb4ea7f7bf1df7cf2f3f80a4df0e90350530 /scilab_doc | |
parent | 67a5b5327624c912a40eb96b0c3d4c00f7bf5957 (diff) | |
download | scilab-a0d9d653d9b36ed1c84402ea7d0a60dea9424622.zip scilab-a0d9d653d9b36ed1c84402ea7d0a60dea9424622.tar.gz |
new
Diffstat (limited to 'scilab_doc')
-rwxr-xr-x | scilab_doc/intro/chap1.tex | 252 | ||||
-rwxr-xr-x | scilab_doc/intro/chap2.tex | 525 | ||||
-rwxr-xr-x | scilab_doc/intro/chap3.tex | 36 | ||||
-rwxr-xr-x | scilab_doc/intro/chap4.tex | 88 | ||||
-rwxr-xr-x | scilab_doc/intro/chap5.tex | 1320 | ||||
-rwxr-xr-x | scilab_doc/intro/intro.tex | 25 |
6 files changed, 675 insertions, 1571 deletions
diff --git a/scilab_doc/intro/chap1.tex b/scilab_doc/intro/chap1.tex index 9db88f1..a8d47d2 100755 --- a/scilab_doc/intro/chap1.tex +++ b/scilab_doc/intro/chap1.tex | |||
@@ -4,46 +4,48 @@ | |||
4 | 4 | ||
5 | \section{What is Scilab} | 5 | \section{What is Scilab} |
6 | 6 | ||
7 | Developed at INRIA, Scilab has been developed for system control and | 7 | Developed at INRIA and ENPC, Scilab has been developed for engineering |
8 | signal processing applications. It | 8 | applications. It is freely distributed (see the copyright file) and the source |
9 | is freely distributed in source code format (see the copyright file). | 9 | code is available. |
10 | 10 | ||
11 | Scilab is made of three distinct parts: an interpreter, | 11 | Scilab is made of three distinct parts: an interpreter, |
12 | libraries of functions (Scilab procedures) and libraries of Fortran | 12 | a set of libraries of Fortran and C routines linked with Scilab |
13 | and C routines. | 13 | and a number of toolboxes written in Scilab language. |
14 | These routines (which, strictly speaking, do not belong to Scilab but | 14 | The numerical librairies (which, strictly speaking, do not belong to Scilab but |
15 | are interactively called by the interpreter) are of | 15 | are interactively called by the interpreter) are of |
16 | independent interest and most of them are available through Netlib. | 16 | independent interest and most of them are available through the Web. |
17 | A few of them have been slightly modified for better compatibility | ||
18 | with Scilab's interpreter. | ||
19 | 17 | ||
20 | A key feature of the Scilab syntax is its ability to handle matrices: | 18 | A key feature of the Scilab syntax is its ability to handle matrices: |
21 | basic matrix manipulations such as concatenation, | 19 | basic matrix manipulations such as concatenation, |
22 | extraction or transpose are immediately performed as well as basic operations | 20 | extraction or transpose are immediately performed as well as basic operations |
23 | such as addition or multiplication. Scilab also aims at handling more complex | 21 | such as addition or multiplication. The syntax for manipulating |
24 | objects than numerical matrices. For instance, control people may want | 22 | matrices is mostly compatible with Matlab. |
25 | to manipulate rational or polynomial transfer matrices. This is | 23 | Scilab also aims at handling more complex |
26 | done in Scilab by manipulating lists and typed lists which allows a | 24 | objects than numerical matrices. This is |
25 | done in Scilab by manipulating structures which allows a | ||
27 | natural symbolic representation of complicated | 26 | natural symbolic representation of complicated |
28 | mathematical objects such as transfer functions, linear systems or graphs | 27 | objects such as transfer functions, linear systems or graphs |
29 | (see Section~\ref{s2.5}). | 28 | (see Section~\ref{s2.5}). |
30 | 29 | ||
31 | Polynomials, polynomials matrices and transfer matrices | 30 | Mathematical objects such as polynomials, polynomials matrices |
32 | are also defined and the syntax used for manipulating these matrices | 31 | and rational polynomial matrices are also defined and the syntax |
33 | is identical to that used for manipulating constant vectors and matrices. | 32 | used for manipulating these matrices is identical to that used for |
33 | manipulating numerical vectors and matrices. | ||
34 | 34 | ||
35 | Scilab provides a variety of powerful primitives for | 35 | Scilab provides a variety of powerful primitives for |
36 | the analysis of non-linear systems. | 36 | the analysis of non-linear systems. |
37 | Integration of explicit and implicit dynamic systems can be accomplished | 37 | Integration of explicit and implicit dynamic systems can be accomplished |
38 | numerically. The {\tt scicos} toolbox allows the graphic definition | 38 | numerically. The {\tt scicos} toolbox allows the graphic definition |
39 | and simulation of complex interconnected hybrid systems. | 39 | and simulation of complex interconnected hybrid systems. Documentation |
40 | about {\tt scicos} can be found at its the Web page | ||
41 | \href{http://www.scicos.org}{scicos.org}. | ||
40 | 42 | ||
41 | There exist numerical optimization | 43 | There exist numerical optimization facilities for non linear |
42 | facilities for non linear optimization (including | 44 | optimization (including non differentiable optimization), quadratic |
43 | non differentiable optimization), quadratic optimization and | 45 | optimization and linear optimization (see also the contribution |
44 | linear optimization. | 46 | directory on the Scilab Web page). |
45 | 47 | ||
46 | Scilab has an open programming environment where the | 48 | Scilab has an open programming environment where the |
47 | creation of functions and libraries of functions is completely in the | 49 | creation of functions and libraries of functions is completely in the |
48 | hands of the user (see Chapter~\ref{ch4}). | 50 | hands of the user (see Chapter~\ref{ch4}). |
49 | Functions are recognized as data objects in Scilab and, thus, can be | 51 | Functions are recognized as data objects in Scilab and, thus, can be |
@@ -68,11 +70,7 @@ a syntax which is natural and easy to use. | |||
68 | \item To provide a reasonable set of primitives which serve | 70 | \item To provide a reasonable set of primitives which serve |
69 | as a basis for a wide variety of calculations. | 71 | as a basis for a wide variety of calculations. |
70 | \item To have an open programming environment where new | 72 | \item To have an open programming environment where new |
71 | primitives are easily added. A useful tool distributed with | 73 | primitives are easily added. |
72 | Scilab is {\tt intersci} which | ||
73 | is a tool for building interface programs to add new primitives | ||
74 | i.e. to add new modules of Fortran or C code into Scilab. | ||
75 | |||
76 | \item To support library development through ``toolboxes'' of | 74 | \item To support library development through ``toolboxes'' of |
77 | functions devoted to specific | 75 | functions devoted to specific |
78 | applications (linear control, signal processing, | 76 | applications (linear control, signal processing, |
@@ -80,7 +78,7 @@ i.e. to add new modules of Fortran or C code into Scilab. | |||
80 | \end{itemize} | 78 | \end{itemize} |
81 | 79 | ||
82 | The objective of this introduction manual is to give the user | 80 | The objective of this introduction manual is to give the user |
83 | an idea of what Scilab can do. On line documentation on all | 81 | an idea of what Scilab can do. On line documentation about all |
84 | functions is available ({\tt help} command). | 82 | functions is available ({\tt help} command). |
85 | 83 | ||
86 | 84 | ||
@@ -90,11 +88,13 @@ Scilab is divided into a set of directories. The main directory | |||
90 | \verb!SCIDIR! contains the following files: {\tt scilab.star} (startup file), the | 88 | \verb!SCIDIR! contains the following files: {\tt scilab.star} (startup file), the |
91 | copyright file {\tt notice.tex}, and the \verb!configure! files | 89 | copyright file {\tt notice.tex}, and the \verb!configure! files |
92 | (see(\ref{install})). | 90 | (see(\ref{install})). |
93 | The subdirectories are the following: | 91 | The main subdirectories are the following: |
94 | \begin{itemize} | 92 | \begin{itemize} |
95 | 93 | ||
96 | \item{{\tt bin} is the directory of the executable files. | 94 | \item{{\tt bin} is the directory of the executable files. |
97 | The starting script {\tt scilab} on Unix/Linux systems and {\tt runscilab.exe} on Windows95/NT, The executable code of Scilab: {\tt scilex} on Unix/Linux systems and {\tt scilex.exe} on Windows95/NT are there. | 95 | The starting script {\tt scilab} on Unix/Linux systems and {\tt runscilab.exe} on Windows. |
96 | The executable code of Scilab: {\tt scilex} on Unix/Linux systems and {\tt scilex.exe} on | ||
97 | Windows are there. | ||
98 | This directory also contains Shell scripts | 98 | This directory also contains Shell scripts |
99 | for managing or printing Postscript/\LaTeX\ files produced by Scilab.} | 99 | for managing or printing Postscript/\LaTeX\ files produced by Scilab.} |
100 | 100 | ||
@@ -108,29 +108,14 @@ Note that running a graphic function without input parameter | |||
108 | provides an example of use for this function (for instance {\tt | 108 | provides an example of use for this function (for instance {\tt |
109 | plot2d()} displays an example for using {\tt plot2d} function). } | 109 | plot2d()} displays an example for using {\tt plot2d} function). } |
110 | 110 | ||
111 | \item{{\tt examples} contains useful examples of how to link | 111 | \item{{\tt examples} contains examples of specific topics. It is shown |
112 | external programs to scilab, using dynamic link or {\tt intersci}} | 112 | in appropriate subdirectories how to add new C or Fortran program |
113 | 113 | to Scilab (see \verb!addinter-tutorial!). More complex examples are given | |
114 | \item{{\tt doc} is the directory of the Scilab documentation: \LaTeX\ , dvi | 114 | in \verb!addinter-examples!. The directory \verb!mex-examples! |
115 | and Postscript files. | 115 | contains examples of interfaces realized by emulating the Matlab |
116 | This documentation is {\tt SCIDIR/doc/intro/intro.tex}. } | 116 | mexfiles. The directory \verb!link-examples! illustrates the use of |
117 | 117 | the \verb!call! function which allows to call external function within | |
118 | \item{{\tt geci} contains source code and binaries for GeCI which is an | 118 | Scilab.} |
119 | interactive communication manager created in order to | ||
120 | manage remote executions of softwares and allow exchanges of messages | ||
121 | beetwen those programs. It offers the possibility to exploit numerous | ||
122 | machines on a network, as a virtual computer, by creating a | ||
123 | distributed group of independent softwares | ||
124 | (\verb!help communications! for a detailed description). | ||
125 | GeCI is used for the link of Xmetanet with Scilab.} | ||
126 | |||
127 | \item{\tt pvm3} contains source code and binaries of the PVM version | ||
128 | 3 which is another interactive communication manager. | ||
129 | |||
130 | \item{{\tt imp} is the directory of the routines managing the Postscript files | ||
131 | for print.} | ||
132 | |||
133 | \item{{\tt libs} contains the Scilab libraries (compiled code).} | ||
134 | 119 | ||
135 | \item{{\tt macros} contains the libraries of functions | 120 | \item{{\tt macros} contains the libraries of functions |
136 | which are available on-line. New libraries can easily be added | 121 | which are available on-line. New libraries can easily be added |
@@ -138,15 +123,12 @@ which are available on-line. New libraries can easily be added | |||
138 | which contain ``Toolboxes'' for control, signal processing, etc... Strictly | 123 | which contain ``Toolboxes'' for control, signal processing, etc... Strictly |
139 | speaking Scilab is not organized in toolboxes : functions of a specific | 124 | speaking Scilab is not organized in toolboxes : functions of a specific |
140 | subdirectory can call functions of other directories; so, for example, the | 125 | subdirectory can call functions of other directories; so, for example, the |
141 | subdirectory {\tt signal} is not self-contained but its functions are all devoted | 126 | subdirectory {\tt signal} is not self-contained but all the functions there |
142 | to signal processing.} | 127 | are devoted to signal processing.} |
143 | 128 | ||
144 | \item{{\tt man} is the directory containing the manual divided | 129 | \item{{\tt man} is the directory containing the manual divided |
145 | into submanuals, corresponding to the on-line help and to | 130 | into submanuals, corresponding to the on-line help.} |
146 | a \LaTeX\ format of the reference manual. | 131 | |
147 | The \LaTeX\ code is produced by a | ||
148 | translation of the Unix format Scilab manual (see the subdirectory | ||
149 | {\tt SCIDIR/man}).} | ||
150 | To get information about an item, one should enter | 132 | To get information about an item, one should enter |
151 | {\tt help item}\index{help@{\tt help}} | 133 | {\tt help item}\index{help@{\tt help}} |
152 | in Scilab or use the help window facility obtained with help button. | 134 | in Scilab or use the help window facility obtained with help button. |
@@ -154,77 +136,47 @@ To get information corresponding to a key-word, one should enter | |||
154 | {\tt apropos key-word} or use | 136 | {\tt apropos key-word} or use |
155 | {\tt apropos}\index{apropos@{\tt apropos}} in the help window. | 137 | {\tt apropos}\index{apropos@{\tt apropos}} in the help window. |
156 | All the {\tt item}s and {\tt key-words} known by the {\tt help} and | 138 | All the {\tt item}s and {\tt key-words} known by the {\tt help} and |
157 | {\tt apropos} commands are in {\tt .cat} and {\tt whatis} files | 139 | {\tt apropos} commands are in {\tt .html} and {\tt whatis} files |
158 | located in the {\tt man} subdirectories. | 140 | located in the {\tt man} subdirectories. |
159 | 141 | ||
160 | To add new items to the {\verb!help!} and {\tt apropos} commands | 142 | To add new items to the {\verb!help!} and {\tt apropos} commands |
161 | the user can extend the list of directories available to the help | 143 | the user can extend the list of directories available to the help |
162 | browser by adapting the variable \verb!%helps!. | 144 | browser by adapting the variable \verb!%helps!. |
163 | See the README file in the \verb!man! directory and the example | ||
164 | given in \verb!examples/man-examples! directory | ||
165 | |||
166 | \item{{\tt maple} is the directory which contains the source code of Maple | ||
167 | functions which allow the transfer of Maple objects | ||
168 | into Scilab functions. For efficiency, the transfer | ||
169 | is made through Fortran code generation which is dynamically linked | ||
170 | to Scilab.} | ||
171 | 145 | ||
172 | \item{{\tt routines} is a directory which contains the source code of all | 146 | \item{{\tt routines} is a directory which contains the source code of all |
173 | the numerical routines. The subdirectory {\tt default} is important | 147 | the numerical routines. The subdirectory {\tt default} is important |
174 | since it contains the | 148 | since it contains the |
175 | source code of routines which are necessary to customize Scilab.} | 149 | source code of routines which are necessary to customize Scilab. |
176 | In particular user's C or Fortran routines for ODE/DAE simulation | 150 | In particular user's C or Fortran routines for ODE/DAE simulation |
177 | or optimization can be included here (they can be also dynamically | 151 | or optimization can be included here (they can be also dynamically |
178 | linked). | 152 | linked)} |
179 | 153 | ||
180 | \item{{\tt examples} contains examples of specific topics. It is shown | 154 | \item{{\tt tests} : this directory contains evaluation programs for testing |
181 | in appropriate subdirectories how to add new C or Fortran program | 155 | Scilab's installation on a machine. The file ``demos.tst'' tests all the |
182 | to Scilab (see \verb!addinter-tutorial!). More complex examples are given | 156 | demos.} |
183 | in \verb!addinter-examples!. The directory \verb!mex-examples! | ||
184 | contains examples of interfaces realized by emulating the Matlab | ||
185 | mexfiles. The directory \verb!link-examples! illustrates the use of | ||
186 | the \verb!call! function which allows to call external function within | ||
187 | Scilab.} | ||
188 | 157 | ||
189 | \item{{\tt intersci} contains a program which can be used to build | 158 | \item{{\tt intersci} contains a program which can be used to build |
190 | interface programs for adding new Fortran or C | 159 | interface programs for adding new Fortran or C |
191 | primitives to Scilab. This program is executed by the {\tt intersci} | 160 | primitives to Scilab. This program is executed by the {\tt intersci} |
192 | script in the {\tt bin/intersci} directory.} | 161 | script in the {\tt bin/intersci} directory.} |
193 | 162 | ||
194 | \item{{\tt scripts} is the directory which contains the source code of | ||
195 | shell scripts files. Note that the list of printers \index{printers} | ||
196 | names known by Scilab is defined there by an environment variable.} | ||
197 | |||
198 | \item{{\tt tests} : this directory contains evaluation programs for testing | ||
199 | Scilab's installation on a machine. The file ``demos.tst'' tests all the | ||
200 | demos.} | ||
201 | |||
202 | \item{{\tt wless, xless} is the Berkeley file browsing tool} | ||
203 | |||
204 | \item{{\tt xmetanet} is the directory which contains {\tt xmetanet}, a | ||
205 | graphic display for networks. Type {\tt metanet()} in Scilab to use it.} | ||
206 | |||
207 | \end{itemize} | 163 | \end{itemize} |
208 | 164 | ||
209 | \section{Installing Scilab. System Requirements} | 165 | \section{Installing Scilab. System Requirements} |
210 | \label{install} | 166 | \label{install} |
211 | Scilab is distributed in source code format; binaries for Windows95/NT | 167 | Scilab is distributed in source code format; binaries for Windows98/NT/XP |
212 | systems and several popular Unix/Linux-XWindow systems are also | 168 | systems and several popular Unix/Linux-XWindow systems are also |
213 | available: Dec Alpha (OSF V4), Dec Mips (ULTRIX 4.2), Sun Sparc | 169 | available. See the Scilab Web page and the contributions for specific |
214 | stations (Sun OS), Sun Sparc stations (Sun Solaris), HP9000 (HP-UX | 170 | ports. All of these binaries versions include tk/tcl interface. |
215 | V10), SGI Mips Irix, PC Linux. All of these binaries versions include | ||
216 | tk/tcl interface. | ||
217 | 171 | ||
218 | The installation requirements are the following : | 172 | The installation requirements are the following : |
219 | 173 | ||
220 | - for the source version: Scilab requires approximately 130Mb of disk | 174 | - for the source version: Scilab requires approximately 130Mb of disk |
221 | storage to unpack and install (all sources included). You need X | 175 | storage to unpack and install (all sources included). You a C |
222 | Window (X11R4, X11R5 or X11R6, C compiler and Fortran compiler | 176 | compiler and a Fortran compiler. |
223 | (e.g. f2c or g77 or Visual C++ for Windows systems). | ||
224 | 177 | ||
225 | - for the binary version: the minimum for running Scilab (without | 178 | - for the binary version: the minimum for running Scilab (without |
226 | sources) is about 40 Mb when decompressed. | 179 | sources) is about 40 Mb when decompressed. |
227 | These versions are partially statically linked and in principle do not require a fortran compiler. | ||
228 | 180 | ||
229 | \label{stks} | 181 | \label{stks} |
230 | Scilab uses a large internal stack for its calculations. This size | 182 | Scilab uses a large internal stack for its calculations. This size |
@@ -234,7 +186,7 @@ command. The default dimension of the internal stack can be adapted | |||
234 | by modifying the variable {\tt newstacksize} in the {\tt scilab.star} | 186 | by modifying the variable {\tt newstacksize} in the {\tt scilab.star} |
235 | script. | 187 | script. |
236 | 188 | ||
237 | - For more information on the installation, please look at the README files | 189 | - For more information on the installation, please look at the README files. |
238 | 190 | ||
239 | \section{Documentation} | 191 | \section{Documentation} |
240 | 192 | ||
@@ -244,21 +196,16 @@ reports devoted to specific toolboxes: Scicos (graphic system builder | |||
244 | and simulator), Signal (Signal processing toolbox), Lmitool (interface for | 196 | and simulator), Signal (Signal processing toolbox), Lmitool (interface for |
245 | LMI problems), Metanet (graph and network toolbox). An FAQ is | 197 | LMI problems), Metanet (graph and network toolbox). An FAQ is |
246 | available at Scilab home page:\\ | 198 | available at Scilab home page:\\ |
247 | (\verb!http://www-rocq.inria.fr/scilab!)\index{home page}. | 199 | (\verb!http://www.scilab.org!)\index{home page}. |
200 | |||
201 | Several documents are available in French, German, Spanish, Chinese etc. | ||
202 | See the Scilab Web page. | ||
248 | 203 | ||
249 | \section{Scilab at a Glance. A Tutorial} | 204 | \section{Scilab at a Glance. A Tutorial} |
250 | 205 | ||
251 | \subsection{Getting Started} | 206 | \subsection{Getting Started} |
252 | 207 | ||
253 | Scilab is called by running the {\tt scilab} script in the | 208 | After starting Scilab, you get: |
254 | directory {\tt SCIDIR/bin} ({\tt SCIDIR} denotes the directory | ||
255 | where Scilab is installed). | ||
256 | This shell script runs Scilab in an Xwindow environment (this | ||
257 | script file can be invoked with | ||
258 | specific parameters such as \verb!-nw! for ``no-window''). | ||
259 | You will immediatly get the Scilab window with the following banner and | ||
260 | prompt represented by the {\tt -->} : | ||
261 | |||
262 | 209 | ||
263 | \bigskip | 210 | \bigskip |
264 | 211 | ||
@@ -268,8 +215,8 @@ prompt represented by the {\tt -->} : | |||
268 | =========== | 215 | =========== |
269 | 216 | ||
270 | 217 | ||
271 | Scilab-2.x ( 12 July 1998 ) | 218 | Scilab-x.y.z |
272 | Copyright (C) 1989-98 INRIA | 219 | Copyright (C) 1989-xx INRIA/ENPC |
273 | 220 | ||
274 | 221 | ||
275 | Startup execution: | 222 | Startup execution: |
@@ -332,65 +279,6 @@ useful if you type your commands in an editor. Another way to | |||
332 | ``load'' files containing Scilab statements | 279 | ``load'' files containing Scilab statements |
333 | is available with the {\tt File/File Operations} button. | 280 | is available with the {\tt File/File Operations} button. |
334 | 281 | ||
335 | \subsection{Buttons} | ||
336 | The Scilab window has the following {\bf Control} buttons.\\ | ||
337 | |||
338 | % | ||
339 | \begin{itemize} | ||
340 | \item Stop interrupts execution of Scilab and enters in | ||
341 | {\tt pause} mode | ||
342 | \item Resume continues execution after a {\tt pause} | ||
343 | entered as a command in a function or generated by the {\tt Stop} | ||
344 | button or Control C. | ||
345 | \item Abort aborts execution after one (or several) {\tt pause}, | ||
346 | and returns to top-level prompt | ||
347 | \item Restart clears all variables and executes startup files | ||
348 | \item Quit quits Scilab | ||
349 | \item Kill kills Scilab shell script | ||
350 | \item Demos for interactive run of some demos | ||
351 | \item File Operations facility for loading functions or data into | ||
352 | Scilab, or executing script files. | ||
353 | \item Help : invokes on-line help with the tree of the man and the | ||
354 | names of the corresponding items. It is possible to type directly | ||
355 | {\tt help <item>} in the Scilab window. | ||
356 | \item Graphic Window : select active graphic window | ||
357 | \end{itemize} | ||
358 | % | ||
359 | New buttons can be added by the | ||
360 | {\tt addmenu}\index{addmenu@{\tt addmenu}} command. | ||
361 | Note that the command:\\ | ||
362 | {\tt SCIDIR/bin/scilab -nw} \\ | ||
363 | invokes Scilab in the ``no-window'' mode. | ||
364 | |||
365 | \subsection{Customizing your Scilab - Unix only} | ||
366 | |||
367 | |||
368 | The parameters of the different windows opened by | ||
369 | Scilab can be easily changed. The way for doing that is to edit the files | ||
370 | contained in the directory {\tt X11-defaults}. The first possibility is | ||
371 | to directly customize these files. Another way is to copy | ||
372 | the right lines with the modifications in the {\tt .Xdefaults} | ||
373 | file of the home directory. | ||
374 | These modifications are activated by starting again Xwindow or with the | ||
375 | command {\tt xrdb .Xdefaults}. Scilab will read the {\tt .Xdefaults} file: | ||
376 | the lines of this | ||
377 | file will cancel and replace the corresponding lines of X11-defaults. | ||
378 | |||
379 | A simple example : | ||
380 | |||
381 | \begin{verbatim} | ||
382 | Xscilab.color*Scrollbar.background:red | ||
383 | Xscilab*vpane.height: 500 | ||
384 | Xscilab*vpane.width: 500 | ||
385 | \end{verbatim} | ||
386 | |||
387 | in {\tt .Xdefaults} will change the 500x650 window to a square window of | ||
388 | 500x500 and the | ||
389 | scrollbar background color changes from green to red. | ||
390 | |||
391 | An important parameter for customizing Scilab is \verb!stacksize! | ||
392 | discussed in \ref{install}. | ||
393 | |||
394 | \subsection{Sample Session for Beginners} | 282 | \subsection{Sample Session for Beginners} |
395 | 283 | ||
396 | We present now some simple commands. At the carriage return all the | 284 | We present now some simple commands. At the carriage return all the |
@@ -446,10 +334,16 @@ A more complicated command which creates a polynomial. | |||
446 | 334 | ||
447 | \noindent\dotfill | 335 | \noindent\dotfill |
448 | 336 | ||
337 | \input{diary/d1p41.dia} | ||
338 | |||
339 | Definition of a structure variable. | ||
340 | |||
341 | \noindent\dotfill | ||
342 | |||
449 | \input{diary/d1p5.dia} | 343 | \input{diary/d1p5.dia} |
450 | 344 | ||
451 | Definition of a polynomial matrix. The syntax for polynomial matrices | 345 | Definition of a polynomial matrix. The syntax for polynomial matrices |
452 | is the same as for constant matrices. Calculation of the | 346 | is the same as for numerical matrices. Calculation of the |
453 | determinant of the polynomial matrix by the {\tt det} function. | 347 | determinant of the polynomial matrix by the {\tt det} function. |
454 | 348 | ||
455 | 349 | ||
@@ -562,16 +456,18 @@ by {\tt exec} or by {\tt getf} ). | |||
562 | 456 | ||
563 | \input{diary/d1p15.dia} | 457 | \input{diary/d1p15.dia} |
564 | 458 | ||
565 | Relation with the Unix environment. | 459 | Relation with the host environment. |
566 | 460 | ||
567 | \noindent\dotfill | 461 | \noindent\dotfill |
568 | 462 | ||
569 | \input{diary/d1p16.dia} | 463 | \input{diary/d1p16.dia} |
570 | 464 | ||
571 | Definition of a column vector of character strings used for defining a C | 465 | Definition of a column vector of character strings used for defining a C |
572 | function file. The routine is compiled (needs a compiler), dynamically | 466 | function file. The routine is compiled (needs a compiler), |
467 | and a shared library is done. The libary is dynamically | ||
573 | linked to Scilab by the {\tt link} command, and interactively called | 468 | linked to Scilab by the {\tt link} command, and interactively called |
574 | by the function {\tt myplus}. | 469 | by the function {\tt myplus}. {\tt myplus} passes variables from Scilab |
470 | to C and conversely. | ||
575 | 471 | ||
576 | \noindent\dotfill | 472 | \noindent\dotfill |
577 | 473 | ||
diff --git a/scilab_doc/intro/chap2.tex b/scilab_doc/intro/chap2.tex index 49e12d2..abaaa8e 100755 --- a/scilab_doc/intro/chap2.tex +++ b/scilab_doc/intro/chap2.tex | |||
@@ -3,13 +3,11 @@ | |||
3 | \chapter{Data Types} | 3 | \chapter{Data Types} |
4 | \label{ch2} | 4 | \label{ch2} |
5 | \index{data types} | 5 | \index{data types} |
6 | |||
7 | Scilab recognizes several data types. | 6 | Scilab recognizes several data types. |
8 | Scalar objects are constants, booleans, polynomials, strings and | 7 | Scalar objects are numerical constants, booleans, polynomials, strings and |
9 | rationals (quotients of polynomials). These objects in turn allow to | 8 | rationals (quotients of polynomials). These objects in turn allow to |
10 | define matrices which admit these scalars as entries. | 9 | define matrices which admit these scalars as entries. |
11 | Other basic objects are lists, typed-lists and functions. Only | 10 | Other basic objects are lists, typed-lists and functions. |
12 | constant and boolean sparse matrices are defined. | ||
13 | % | 11 | % |
14 | The objective of this chapter is to describe the use of each of | 12 | The objective of this chapter is to describe the use of each of |
15 | these data types. | 13 | these data types. |
@@ -55,7 +53,7 @@ of these objects are revealed in the following Scilab sessions. | |||
55 | Scalars are either real or complex numbers. The values of | 53 | Scalars are either real or complex numbers. The values of |
56 | scalars can be assigned to variable names chosen by the user. | 54 | scalars can be assigned to variable names chosen by the user. |
57 | \begin{verbatim} | 55 | \begin{verbatim} |
58 | --> a=5+2*%i | 56 | --> a=5+2*%i //a complex number |
59 | a = | 57 | a = |
60 | 58 | ||
61 | 5. + 2.i | 59 | 5. + 2.i |
@@ -317,10 +315,10 @@ manipulated as full matrices. | |||
317 | \index{data types!character strings} | 315 | \index{data types!character strings} |
318 | \index{character strings} | 316 | \index{character strings} |
319 | 317 | ||
320 | Character strings can be created by using single or double quotes. | 318 | Character strings can be created by using single or double quotes. |
321 | Concatenation of strings is performed by the {\tt +} operation. | 319 | Concatenation of strings is performed by the {\tt +} operation. |
322 | Matrices of character strings are constructed as ordinary matrices, | 320 | Matrices of character strings are constructed as ordinary matrices, |
323 | e.g. using brackets. A very important feature of matrices of | 321 | e.g. using brackets. An important feature of matrices of |
324 | character strings is the capacity to manipulate and create functions. | 322 | character strings is the capacity to manipulate and create functions. |
325 | Furthermore, symbolic manipulation of mathematical objects can be | 323 | Furthermore, symbolic manipulation of mathematical objects can be |
326 | implemented using matrices of character strings. The following | 324 | implemented using matrices of character strings. The following |
@@ -354,10 +352,46 @@ Note that in the above Scilab session the function | |||
354 | {\tt trianfml}\index{trianfml@{\tt trianfml}}\index{symbolic triangularization} | 352 | {\tt trianfml}\index{trianfml@{\tt trianfml}}\index{symbolic triangularization} |
355 | performs the symbolic triangularization of the matrix {\tt A}. | 353 | performs the symbolic triangularization of the matrix {\tt A}. |
356 | The value of the resulting symbolic matrix can be obtained by | 354 | The value of the resulting symbolic matrix can be obtained by |
357 | using {\tt evstr}. | 355 | using {\tt evstr}. |
356 | |||
357 | The following table gives the list of some useful functions: | ||
358 | |||
359 | \begin{center} | ||
360 | \begin{tabular}{|c|c|} | ||
361 | \hline | ||
362 | \verb!ascii! & ascii code of strings\\ \hline | ||
363 | |||
364 | \verb!execstr! & executes the string\\ \hline | ||
365 | |||
366 | \verb!grep ! & looks for a chain into a matrix \\ \hline | ||
367 | |||
368 | \verb!sort, gsort ! & sorting (lexicographic,...) \\ \hline | ||
369 | |||
370 | \verb!part! & extract a subchain \\ \hline | ||
371 | |||
372 | \verb!mmscanf! & formated read into a chain \\ \hline | ||
373 | |||
374 | \verb!msprintf! & construct a chain/vector \\ \hline | ||
375 | |||
376 | \verb!strindex! & location of a subchain \\ \hline | ||
377 | |||
378 | \verb!string ! & convert into a string \\ \hline | ||
379 | |||
380 | \verb!stripblanks! & remove blank characters \\ \hline | ||
358 | 381 | ||
359 | A very important aspect of character strings is that they | 382 | \verb!strsubst! & chain replacement \\ \hline |
360 | can be used to automatically create new functions (for more on functions | 383 | |
384 | \verb!tokens! & cuts a chain \\ \hline | ||
385 | |||
386 | \verb!strcat! & catenates chains \\ \hline | ||
387 | |||
388 | \verb!length! & chain length \\ \hline | ||
389 | \end{tabular} | ||
390 | \end{center} | ||
391 | |||
392 | |||
393 | A string matrices can be used to create new | ||
394 | functions (for more on functions | ||
361 | see Section~\ref{s4.2}). An example of automatically creating a | 395 | see Section~\ref{s4.2}). An example of automatically creating a |
362 | function is illustrated in the following Scilab session where it is | 396 | function is illustrated in the following Scilab session where it is |
363 | desired to study a polynomial of two variables {\tt s} and {\tt t}. | 397 | desired to study a polynomial of two variables {\tt s} and {\tt t}. |
@@ -366,13 +400,12 @@ supported in Scilab, we can construct a new data structure using | |||
366 | a list (see Section~\ref{s2.5}). | 400 | a list (see Section~\ref{s2.5}). |
367 | The polynomial to be studied is $(t^2+2t^3)-(t+t^2)s+ts^2+s^3$. | 401 | The polynomial to be studied is $(t^2+2t^3)-(t+t^2)s+ts^2+s^3$. |
368 | \begin{verbatim} | 402 | \begin{verbatim} |
369 | -->getf("macros/make_macro.sci"); | ||
370 | |||
371 | -->s=poly(0,'s');t=poly(0,'t'); | 403 | -->s=poly(0,'s');t=poly(0,'t'); |
372 | 404 | ||
373 | -->p=list(t^2+2*t^3,-t-t^2,t,1+0*t); | 405 | -->p=list(t^2+2*t^3,-t-t^2,t,1+0*t); |
374 | 406 | ||
375 | -->pst=makefunction(p) //pst is a function t->p (number->polynomial) | 407 | -->pst=makefunction(p) //pst is a function |
408 | // t->p (number->polynomial) | ||
376 | pst = | 409 | pst = |
377 | 410 | ||
378 | [p]=pst(t) | 411 | [p]=pst(t) |
@@ -414,7 +447,7 @@ evaluates to the polynomial in two variables. | |||
414 | 447 | ||
415 | Polynomials are easily created and manipulated in Scilab. | 448 | Polynomials are easily created and manipulated in Scilab. |
416 | Manipulation of polynomial matrices is essentially identical | 449 | Manipulation of polynomial matrices is essentially identical |
417 | to that of constant matrices. | 450 | to that of constant numerical matrices. |
418 | The {\tt poly}\index{poly@{\tt poly}} | 451 | The {\tt poly}\index{poly@{\tt poly}} |
419 | primitive in Scilab can be used to specify the coefficients | 452 | primitive in Scilab can be used to specify the coefficients |
420 | of a polynomial or the roots of a polynomial. | 453 | of a polynomial or the roots of a polynomial. |
@@ -476,13 +509,7 @@ for systems theory. | |||
476 | 509 | ||
477 | -->s=poly(0,'s'); | 510 | -->s=poly(0,'s'); |
478 | 511 | ||
479 | -->A=[1 s;s 1+s^2] | 512 | -->A=[1 s;s 1+s^2]; //Polynomial matrix |
480 | A = | ||
481 | |||
482 | ! 1 s ! | ||
483 | ! ! | ||
484 | ! 2 ! | ||
485 | ! s 1 + s ! | ||
486 | 513 | ||
487 | --> B=[1/s 1/(1+s);1/(1+s) 1/s^2] | 514 | --> B=[1/s 1/(1+s);1/(1+s) 1/s^2] |
488 | B = | 515 | B = |
@@ -691,6 +718,89 @@ AND, OR and NOT bit-wise operations. | |||
691 | 253 | 718 | 253 |
692 | \end{verbatim} | 719 | \end{verbatim} |
693 | %%%%% | 720 | %%%%% |
721 | \section{N-dimensionnal arrays} | ||
722 | N-dimensionnal array can be defined and handled in simple way: | ||
723 | \begin{verbatim} | ||
724 | -->M(2,2,2)=3 | ||
725 | M = | ||
726 | |||
727 | (:,:,1) | ||
728 | |||
729 | ! 0. 0. ! | ||
730 | ! 0. 0. ! | ||
731 | (:,:,2) | ||
732 | |||
733 | ! 0. 0. ! | ||
734 | ! 0. 3. ! | ||
735 | |||
736 | -->M(:,:,1)=rand(2,2) | ||
737 | M = | ||
738 | |||
739 | (:,:,1) | ||
740 | |||
741 | ! 0.9329616 0.312642 ! | ||
742 | ! 0.2146008 0.3616361 ! | ||
743 | (:,:,2) | ||
744 | |||
745 | ! 0. 0. ! | ||
746 | ! 0. 3. ! | ||
747 | |||
748 | -->M(2,2,:) | ||
749 | ans = | ||
750 | |||
751 | (:,:,1) | ||
752 | |||
753 | 0.3616361 | ||
754 | (:,:,2) | ||
755 | |||
756 | 3. | ||
757 | -->size(M) | ||
758 | ans = | ||
759 | |||
760 | ! 2. 2. 2. ! | ||
761 | |||
762 | -->size(M,3) | ||
763 | ans = | ||
764 | |||
765 | 2. | ||
766 | |||
767 | \end{verbatim} | ||
768 | |||
769 | They can be created from a vector of data and a vector of dimension | ||
770 | |||
771 | \begin{verbatim} | ||
772 | -->hypermat([2 3,2],1:12) | ||
773 | ans = | ||
774 | |||
775 | (:,:,1) | ||
776 | |||
777 | ! 1. 3. 5. ! | ||
778 | ! 2. 4. 6. ! | ||
779 | (:,:,2) | ||
780 | |||
781 | ! 7. 9. 11. ! | ||
782 | ! 8. 10. 12. ! | ||
783 | |||
784 | \end{verbatim} | ||
785 | |||
786 | N-dimensionnal matrices are coded as {\tt mlists} with 2 fields~: | ||
787 | \begin{verbatim} | ||
788 | -->M=hypermat([2,3,2],1:12); | ||
789 | -->M.dims | ||
790 | ans = | ||
791 | |||
792 | ! 2. 3. 2. ! | ||
793 | -->M.entries' | ||
794 | ans = | ||
795 | column 1 to 11 | ||
796 | |||
797 | ! 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. ! | ||
798 | |||
799 | column 12 | ||
800 | |||
801 | ! 12. ! | ||
802 | \end{verbatim} | ||
803 | |||
694 | 804 | ||
695 | \section{Lists} | 805 | \section{Lists} |
696 | \label{s2.5} | 806 | \label{s2.5} |
@@ -709,26 +819,16 @@ example: | |||
709 | \begin{verbatim} | 819 | \begin{verbatim} |
710 | -->L=list(1,'w',ones(2,2)) //L is a list made of 3 entries | 820 | -->L=list(1,'w',ones(2,2)) //L is a list made of 3 entries |
711 | L = | 821 | L = |
712 | |||
713 | |||
714 | L(1) | 822 | L(1) |
715 | 823 | ||
716 | 1. | 824 | 1. |
717 | |||
718 | L(2) | 825 | L(2) |
719 | |||
720 | w | 826 | w |
721 | |||
722 | L(3) | 827 | L(3) |
723 | 828 | ! 1. 1. ! | |
724 | ! 1. 1. ! | ||
725 | ! 1. 1. ! | 829 | ! 1. 1. ! |
726 | 830 | ||
727 | -->L(3) //extracting entry 3 of list L | 831 | -->L(3); //extracting entry 3 of list L |
728 | ans = | ||
729 | |||
730 | ! 1. 1. ! | ||
731 | ! 1. 1. ! | ||
732 | 832 | ||
733 | -->L(3)(2,2) //entry 2,2 of matrix L(3) | 833 | -->L(3)(2,2) //entry 2,2 of matrix L(3) |
734 | ans = | 834 | ans = |
@@ -737,26 +837,16 @@ example: | |||
737 | 837 | ||
738 | -->L(2)=list('w',rand(2,2)) //nested list: L(2) is now a list | 838 | -->L(2)=list('w',rand(2,2)) //nested list: L(2) is now a list |
739 | L = | 839 | L = |
740 | |||
741 | |||
742 | L(1) | 840 | L(1) |
743 | 841 | ||
744 | 1. | 842 | 1. |
745 | |||
746 | L(2) | 843 | L(2) |
747 | |||
748 | |||
749 | L(2)(1) | 844 | L(2)(1) |
750 | |||
751 | w | 845 | w |
752 | |||
753 | L(2)(2) | 846 | L(2)(2) |
754 | |||
755 | ! 0.6653811 0.8497452 ! | 847 | ! 0.6653811 0.8497452 ! |
756 | ! 0.6283918 0.6857310 ! | 848 | ! 0.6283918 0.6857310 ! |
757 | |||
758 | L(3) | 849 | L(3) |
759 | |||
760 | ! 1. 1. ! | 850 | ! 1. 1. ! |
761 | ! 1. 1. ! | 851 | ! 1. 1. ! |
762 | 852 | ||
@@ -778,10 +868,7 @@ by using character strings (the names) as shown below. | |||
778 | \begin{verbatim} | 868 | \begin{verbatim} |
779 | -->L=tlist(['Car';'Name';'Dimensions'],'Nevada',[2,3]) | 869 | -->L=tlist(['Car';'Name';'Dimensions'],'Nevada',[2,3]) |
780 | L = | 870 | L = |
781 | |||
782 | |||
783 | L(1) | 871 | L(1) |
784 | |||
785 | !Car ! | 872 | !Car ! |
786 | ! ! | 873 | ! ! |
787 | !Name ! | 874 | !Name ! |
@@ -789,23 +876,16 @@ by using character strings (the names) as shown below. | |||
789 | !Dimensions ! | 876 | !Dimensions ! |
790 | 877 | ||
791 | L(2) | 878 | L(2) |
792 | |||
793 | Nevada | 879 | Nevada |
794 | |||
795 | L(3) | 880 | L(3) |
796 | |||
797 | ! 2. 3. ! | 881 | ! 2. 3. ! |
798 | 882 | ||
799 | -->L.Name //same as L(2) | 883 | -->L.Name //same as L(2) |
800 | ans = | 884 | ans = |
801 | |||
802 | Nevada | 885 | Nevada |
803 | |||
804 | -->L.Dimensions(1,2)=2.3 | 886 | -->L.Dimensions(1,2)=2.3 |
805 | 887 | ||
806 | L = | 888 | L = |
807 | |||
808 | |||
809 | L(1) | 889 | L(1) |
810 | 890 | ||
811 | !Car ! | 891 | !Car ! |
@@ -815,13 +895,10 @@ by using character strings (the names) as shown below. | |||
815 | !Dimensions ! | 895 | !Dimensions ! |
816 | 896 | ||
817 | L(2) | 897 | L(2) |
818 | |||
819 | Nevada | 898 | Nevada |
820 | |||
821 | L(3) | 899 | L(3) |
822 | 900 | ||
823 | ! 2. 2.3 ! | 901 | ! 2. 2.3 ! |
824 | |||
825 | 902 | ||
826 | -->L(3)(1,2) | 903 | -->L(3)(1,2) |
827 | ans = | 904 | ans = |
@@ -836,264 +913,10 @@ by using character strings (the names) as shown below. | |||
836 | An important feature of typed-lists is that it is possible to define | 913 | An important feature of typed-lists is that it is possible to define |
837 | operators acting on them (overloading), i.e., it is possible | 914 | operators acting on them (overloading), i.e., it is possible |
838 | to define e.g. the multiplication \verb!L1*L2! of the two typed lists | 915 | to define e.g. the multiplication \verb!L1*L2! of the two typed lists |
839 | \verb!L1! and \verb!L2!. An example of use is given below, where | 916 | \verb!L1! and \verb!L2!. |
840 | linear systems manipulations (concatenation, addition, | ||
841 | multiplication,...) are done by such operations. | ||
842 | \section{N-dimensionnal arrays} | ||
843 | N-dimensionnal array can be defined and handled in simple way: | ||
844 | \begin{verbatim} | ||
845 | -->M(2,2,2)=3 | ||
846 | M = | ||
847 | |||
848 | (:,:,1) | ||
849 | |||
850 | ! 0. 0. ! | ||
851 | ! 0. 0. ! | ||
852 | (:,:,2) | ||
853 | |||
854 | ! 0. 0. ! | ||
855 | ! 0. 3. ! | ||
856 | |||
857 | -->M(:,:,1)=rand(2,2) | ||
858 | M = | ||
859 | |||
860 | (:,:,1) | ||
861 | |||
862 | ! 0.9329616 0.312642 ! | ||
863 | ! 0.2146008 0.3616361 ! | ||
864 | (:,:,2) | ||
865 | |||
866 | ! 0. 0. ! | ||
867 | ! 0. 3. ! | ||
868 | |||
869 | -->M(2,2,:) | ||
870 | ans = | ||
871 | |||
872 | (:,:,1) | ||
873 | |||
874 | 0.3616361 | ||
875 | (:,:,2) | ||
876 | |||
877 | 3. | ||
878 | -->size(M) | ||
879 | ans = | ||
880 | |||
881 | ! 2. 2. 2. ! | ||
882 | |||
883 | -->size(M,3) | ||
884 | ans = | ||
885 | |||
886 | 2. | ||
887 | |||
888 | \end{verbatim} | ||
889 | 917 | ||
890 | They can be created from a vector of data and a vector of dimension | ||
891 | |||
892 | \begin{verbatim} | ||
893 | -->hypermat([2 3,2],1:12) | ||
894 | ans = | ||
895 | |||
896 | (:,:,1) | ||
897 | |||
898 | ! 1. 3. 5. ! | ||
899 | ! 2. 4. 6. ! | ||
900 | (:,:,2) | ||
901 | |||
902 | ! 7. 9. 11. ! | ||
903 | ! 8. 10. 12. ! | ||
904 | |||
905 | \end{verbatim} | ||
906 | 918 | ||
907 | N-dimensionnal matrices are coded as {\tt mlists} with 2 fields~: | 919 | \section{Functions} |
908 | \begin{verbatim} | ||
909 | -->M=hypermat([2 3,2],1:12); | ||
910 | -->M.dims | ||
911 | ans = | ||
912 | |||
913 | ! 2. 3. 2. ! | ||
914 | -->M.entries | ||
915 | ans = | ||
916 | |||
917 | ! 1. ! | ||
918 | ! 2. ! | ||
919 | ! 3. ! | ||
920 | ! 4. ! | ||
921 | ! 5. ! | ||
922 | ! 6. ! | ||
923 | ! 7. ! | ||
924 | ! 8. ! | ||
925 | ! 9. ! | ||
926 | ! 10. ! | ||
927 | ! 11. ! | ||
928 | ! 12. ! | ||
929 | \end{verbatim} | ||
930 | |||
931 | \section{Linear system representation} | ||
932 | Linear systems are treated as specific typed lists {\tt tlist}. | ||
933 | The basic function which is used for defining linear systems is {\tt syslin}. | ||
934 | This function receives as parameters the constant matrices which | ||
935 | define a linear system in state-space form or, in the case of | ||
936 | system in transfer form, its input must be a rational matrix. | ||
937 | To be more specific, the calling sequence of {\tt syslin} is | ||
938 | either {\tt Sl=syslin('dom',A,B,C,D,x0)} or {\tt Sl=syslin('dom',trmat)}. | ||
939 | {\tt dom} is one of the character strings {\tt 'c'} or {\tt 'd'} | ||
940 | for continuous time or discrete time systems respectively. | ||
941 | It is useful to note that {\tt D} can be a polynomial matrix | ||
942 | (improper systems); {\tt D} and {\tt x0} are optional arguments. | ||
943 | {\tt trmat} is a rational matrix i.e. it is defined as a matrix | ||
944 | of rationals (ratios of polynomials). {\tt syslin} just converts | ||
945 | its arguments (e.g. the four matrices A,B,C,D) into a typed | ||
946 | list {\tt Sl}. For state space representation {\tt Sl} is | ||
947 | the {\tt tlist(['lss','A','B','C','D'],A,B,C,D,'dom')}. This tlist | ||
948 | representation allows to access the A-matrix i.e. the second entry of | ||
949 | {\tt Sl} by the syntax {\tt Sl('A')} (equivalent to {\tt Sl(2)}). | ||
950 | Conversion from a representation to another is done by {\tt ss2tf} | ||
951 | or {\tt tf2ss}. Improper systems are also treated. {\tt syslin} | ||
952 | defines linear systems as specific {\tt tlist}. ({\tt help syslin}). | ||
953 | |||
954 | \input{diary/syslin.dia} | ||
955 | |||
956 | The list representation allows manipulating linear systems as | ||
957 | abstract data objects. For example, the linear system can be combined | ||
958 | with other linear systems or the transfer function representation of | ||
959 | the linear system can be obtained as was done above using {\tt ss2tf}. | ||
960 | Note that the transfer function representation of the linear system | ||
961 | is itself a tlist. | ||
962 | A very useful aspect of the manipulation of systems | ||
963 | is that a system can be handled as a data object. | ||
964 | Linear systems can be | ||
965 | inter-connected\index{linear systems!inter-connection of}, | ||
966 | their representation | ||
967 | can easily be changed from state-space to transfer function | ||
968 | and vice versa. | ||
969 | |||
970 | The inter-connection of linear systems can be made | ||
971 | as illustrated in Figure~\ref{f3.2}. | ||
972 | % | ||
973 | \begin{figure} | ||
974 | |||
975 | %BEGIN IMAGE | ||
976 | \begin{center} | ||
977 | \begin{picture}(200,330)(0,-60) | ||
978 | |||
979 | \put(180,280){\makebox(0,0)[lb]{\tt S2*S1}} | ||
980 | \put(9,280){\circle{2}} | ||
981 | \put(10,280){\vector(1,0){20}} | ||
982 | \put(30,270){\framebox(30,20){$S_1$}} | ||
983 | \put(60,280){\vector(1,0){30}} | ||
984 | \put(90,270){\framebox(30,20){$S_2$}} | ||
985 | \put(120,280){\vector(1,0){20}} | ||
986 | \put(141,280){\circle{2}} | ||
987 | |||
988 | \put(180,220){\makebox(0,0)[lb]{\tt S1+S2}} | ||
989 | \put(29,220){\circle{2}} | ||
990 | \put(30,220){\line(1,0){20}} | ||
991 | \put(50,220){\circle*{2}} | ||
992 | \put(50,200){\line(0,1){40}} | ||
993 | \put(50,200){\vector(1,0){20}} | ||
994 | \put(50,240){\vector(1,0){20}} | ||
995 | \put(70,190){\framebox(30,20){$S_2$}} | ||
996 | \put(70,230){\framebox(30,20){$S_1$}} | ||
997 | \put(100,200){\line(1,0){20}} | ||
998 | \put(100,240){\line(1,0){20}} | ||
999 | \put(120,240){\vector(0,-1){15}} | ||
1000 | \put(120,200){\vector(0,1){15}} | ||
1001 | \put(120,220){\circle{10}} | ||
1002 | \put(120,220){\framebox(0,0){$+$}} | ||
1003 | \put(125,220){\vector(1,0){15}} | ||
1004 | \put(141,220){\circle{2}} | ||
1005 | |||
1006 | \put(180,140){\makebox(0,0)[lb]{\tt [S1,S2]}} | ||
1007 | \put(49,160){\circle{2}} | ||
1008 | \put(49,120){\circle{2}} | ||
1009 | \put(50,120){\vector(1,0){20}} | ||
1010 | \put(50,160){\vector(1,0){20}} | ||
1011 | \put(70,110){\framebox(30,20){$S_2$}} | ||
1012 | \put(70,150){\framebox(30,20){$S_1$}} | ||
1013 | \put(100,120){\line(1,0){20}} | ||
1014 | \put(100,160){\line(1,0){20}} | ||
1015 | \put(120,160){\vector(0,-1){15}} | ||
1016 | \put(120,120){\vector(0,1){15}} | ||
1017 | \put(120,140){\circle{10}} | ||
1018 | \put(120,140){\framebox(0,0){$+$}} | ||
1019 | \put(125,140){\vector(1,0){15}} | ||
1020 | \put(141,140){\circle{2}} | ||
1021 | |||
1022 | \put(180,50){\makebox(0,0)[lb]{\tt [S1 ; S2]}} | ||
1023 | \put(49,50){\circle{2}} | ||
1024 | \put(50,50){\line(1,0){20}} | ||
1025 | \put(70,50){\circle*{2}} | ||
1026 | \put(70,30){\line(0,1){40}} | ||
1027 | \put(70,30){\vector(1,0){20}} | ||
1028 | \put(70,70){\vector(1,0){20}} | ||
1029 | \put(90,20){\framebox(30,20){$S_2$}} | ||
1030 | \put(90,60){\framebox(30,20){$S_1$}} | ||
1031 | \put(120,30){\vector(1,0){20}} | ||
1032 | \put(120,70){\vector(1,0){20}} | ||
1033 | \put(141,30){\circle{2}} | ||
1034 | \put(141,70){\circle{2}} | ||
1035 | |||
1036 | \put(180,-40){\makebox(0,0)[lb]{\tt S1/.S2}} | ||
1037 | \put(70,-20){\circle{10}} | ||
1038 | \put(70,-20){\framebox(0,0){$+$}} | ||
1039 | \put(34,-20){\vector(1,0){30}} | ||
1040 | \put(33,-20){\circle{2}} | ||
1041 | \put(70,-60){\line(0,1){40}} | ||
1042 | \put(70,-60){\line(1,0){20}} | ||
1043 | \put(70,-20){\vector(1,0){20}} | ||
1044 | \put(90,-70){\framebox(30,20){$S_2$}} | ||
1045 | \put(90,-30){\framebox(30,20){$S_1$}} | ||
1046 | \put(140,-60){\vector(-1,0){20}} | ||
1047 | \put(120,-20){\line(1,0){20}} | ||
1048 | \put(141,-20){\circle{2}} | ||
1049 | \put(140,-60){\line(0,1){40}} | ||
1050 | \end{picture} | ||
1051 | \end{center} | ||
1052 | %END IMAGE | ||
1053 | %HEVEA\imageflush | ||
1054 | |||
1055 | \caption{Inter-Connection of Linear Systems} | ||
1056 | \label{f3.2} | ||
1057 | \end{figure} | ||
1058 | % | ||
1059 | For each of the possible inter-connections of two systems | ||
1060 | {\tt S1} and {\tt S2} the command which makes the inter-connection | ||
1061 | is shown on the right side of the corresponding block diagram in | ||
1062 | Figure~\ref{f3.2}. Note that feedback interconnection is performed by | ||
1063 | \verb!S1/.S2!. | ||
1064 | |||
1065 | The representation of linear systems can be in state-space | ||
1066 | form or in transfer function form. These two representations can | ||
1067 | be interchanged by using the functions | ||
1068 | {\tt tf2ss}\index{linear systems!{\tt tf2ss}}\index{tf2ss@{\tt tf2ss}} and | ||
1069 | {\tt ss2tf}\index{linear systems!{\tt ss2tf}}\index{ss2tf@{\tt ss2tf}} | ||
1070 | which change the representations of systems from transfer function | ||
1071 | to state-space and from state-space to transfer function, respectively. | ||
1072 | An example of the creation, the change in representation, and the | ||
1073 | inter-connection of linear systems is demonstrated in the following | ||
1074 | Scilab session. | ||
1075 | |||
1076 | \input{diary/connect.dia} | ||
1077 | |||
1078 | The above session is a bit long but illustrates some very important | ||
1079 | aspects of the handling of linear systems. First, two linear systems | ||
1080 | are created in transfer function form using the function called | ||
1081 | {\tt syslin}\index{linear systems!{\tt syslin}}\index{syslin@{\tt syslin}}. | ||
1082 | This function was used to label the systems in this example | ||
1083 | as being continuous (as opposed to discrete). | ||
1084 | The primitive {\tt tf2ss} is used to convert one of the | ||
1085 | two transfer functions to its equivalent state-space representation | ||
1086 | which is in list form (note that the function {\tt ssprint} creates a more | ||
1087 | readable format for the state-space linear system). | ||
1088 | The following multiplication of the two systems yields their | ||
1089 | series inter-connection. Notice that the inter-connection | ||
1090 | of the two systems is effected even though one of the systems is | ||
1091 | in state-space form and the other is in transfer function form. | ||
1092 | The resulting inter-connection is given in state-space form. | ||
1093 | Finally, the function {\tt ss2tf} is used to convert the resulting | ||
1094 | inter-connected systems to the equivalent transfer function representation. | ||
1095 | |||
1096 | \section{Functions (Macros)} | ||
1097 | \label{s2.6} | 920 | \label{s2.6} |
1098 | \index{data types!functions} | 921 | \index{data types!functions} |
1099 | \index{functions} | 922 | \index{functions} |
@@ -1115,8 +938,6 @@ can be created directly in the Scilab environment using the syntax | |||
1115 | --> if y>0 then, x=1; else, x=-1; end | 938 | --> if y>0 then, x=1; else, x=-1; end |
1116 | --> endfunction | 939 | --> endfunction |
1117 | 940 | ||
1118 | --> deff('[x]=foo(y)','if y>0 then, x=1; else, x=-1; end') | ||
1119 | |||
1120 | --> foo(5) | 941 | --> foo(5) |
1121 | ans = | 942 | ans = |
1122 | 943 | ||
@@ -1202,7 +1023,9 @@ SYMBOL & OPERATION | |||
1202 | 1023 | ||
1203 | \verb!( )! & insertion: \verb!a(k)=m! \\ \hline | 1024 | \verb!( )! & insertion: \verb!a(k)=m! \\ \hline |
1204 | 1025 | ||
1205 | \verb!'! & transpose \\ \hline | 1026 | \verb!.'! & transpose \\ \hline |
1027 | |||
1028 | \verb!'! & conjugate transpose \\ \hline | ||
1206 | 1029 | ||
1207 | \verb!+! & addition \\ \hline | 1030 | \verb!+! & addition \\ \hline |
1208 | 1031 | ||
@@ -1241,10 +1064,82 @@ or \verb!help insertion!. | |||
1241 | \subsection{Indexing in matrices} | 1064 | \subsection{Indexing in matrices} |
1242 | Indexing in matrices can be done by giving the indices of selected | 1065 | Indexing in matrices can be done by giving the indices of selected |
1243 | rows and columns or by boolean indices or by using the \verb!$! symbol. | 1066 | rows and columns or by boolean indices or by using the \verb!$! symbol. |
1067 | Here is a sample of commands: | ||
1244 | \input{diary/extract.dia} | 1068 | \input{diary/extract.dia} |
1245 | 1069 | ||
1246 | \subsection{Indexing in lists} | 1070 | \subsection{Indexing in lists} |
1247 | The following session illustrates how to create lists and | 1071 | The following session illustrates how to create lists and |
1248 | insert/extract entries in {\tt list} and {\tt tlist} or {\tt mlist}. | 1072 | insert/extract entries in {\tt list} and {\tt tlist} or {\tt mlist}. |
1249 | Enter {\tt help insertion} and {\tt help extraction} for additinal examples. | 1073 | Enter {\tt help insertion} and {\tt help extraction} for additinal examples. |
1074 | Below is a sample of commands: | ||
1250 | \input{diary/list.dia} | 1075 | \input{diary/list.dia} |
1076 | |||
1077 | \subsection{Structs and Cells \`a la Matlab} | ||
1078 | The command {\tt X=tlist(...)} or {\tt Y=mlist(...)} creates a | ||
1079 | Scilab variable X of type {\tt tlist} or {\tt mlist}. | ||
1080 | The entries of {\tt X} are obtained by the names of their fields. | ||
1081 | |||
1082 | For instance, if {\tt X=tlist(['mytype','a','b'],A,B)} the command | ||
1083 | X.a returns A. If A is a matrix the command X.a(2,3) returns the | ||
1084 | entry at row 2 and column 3 of X;a, i.e. {\tt A(2,3)}. | ||
1085 | Similarly, if {\tt Y=mlist(['mytype','a','b'],A,B)}, we can use the | ||
1086 | syntax Y(2,3), once the extraction function \verb! %mytype_e(varargin)! | ||
1087 | has been defined. | ||
1088 | |||
1089 | Also the syntax {\tt Y(2,3)=33} can be given a meaning | ||
1090 | through the function \verb!%s_i_mytype(varargin)!. | ||
1091 | This powerful overloading mechanism allows to define complex objects | ||
1092 | with a general indexing where indices can be fields (string) or a set | ||
1093 | of integers. | ||
1094 | |||
1095 | If the variable X is not defined in the Scilab workspace, then | ||
1096 | the command X.a=A creates a particular mlist which behaves as | ||
1097 | a Matlab struct. Its internal representation is similar to | ||
1098 | {\tt X=mlist(['st','dims','a'],int32([1,1]),A)}. | ||
1099 | It is a one dimensional {\tt struct} with one field called 'a' and | ||
1100 | the value of X.a is A. | ||
1101 | Multidimensional structs are created and manipulated in a similar way. | ||
1102 | For instance {\tt X(2,3).a.b(2)=4} creates a 2 x 3 struct with one field | ||
1103 | a. It is represented as | ||
1104 | \begin{verbatim} | ||
1105 | mlist(['st','dims','a'],int32([2,3]),list([],[],[],[],[],w)) | ||
1106 | \end{verbatim} | ||
1107 | where w is a struct with one field 'b', and w.b is the vector [0,4]. | ||
1108 | A particular display is done for structs. Here, we have: | ||
1109 | \begin{verbatim} | ||
1110 | -->X(2,3) | ||
1111 | ans = | ||
1112 | |||
1113 | a: [1x1 struct] | ||
1114 | |||
1115 | -->X(2,3).a | ||
1116 | ans = | ||
1117 | |||
1118 | b: [0;4] | ||
1119 | \end{verbatim} | ||
1120 | |||
1121 | All the struct manipulations are implemented by soft coded operations | ||
1122 | i.e. Scilab overloaded functions. As structs are not basic data types | ||
1123 | some operations are slow. They have been implemented for a better | ||
1124 | Matlab compatibility. | ||
1125 | |||
1126 | The Matlab cells are also easily emulated. A cell is seen as a particular | ||
1127 | struct with one field called 'entries'. We just show a simple example: | ||
1128 | |||
1129 | \begin{verbatim} | ||
1130 | |||
1131 | -->X=cell(1,2) | ||
1132 | X = | ||
1133 | |||
1134 | !{} {} ! | ||
1135 | |||
1136 | -->X(2).entries=11 | ||
1137 | X = | ||
1138 | |||
1139 | !{} ! | ||
1140 | ! ! | ||
1141 | !11 ! | ||
1142 | \end{verbatim} | ||
1143 | |||
1144 | Note that Matlab uses braces \verb!X{2}! for extracting entries from | ||
1145 | a cell. | ||
diff --git a/scilab_doc/intro/chap3.tex b/scilab_doc/intro/chap3.tex index 19dff2a..fcd1734 100755 --- a/scilab_doc/intro/chap3.tex +++ b/scilab_doc/intro/chap3.tex | |||
@@ -4,22 +4,22 @@ | |||
4 | \label{ch4} | 4 | \label{ch4} |
5 | \index{programming} | 5 | \index{programming} |
6 | 6 | ||
7 | One of the most useful features of Scilab is its ability | 7 | One of the most useful features of Scilab is its ability |
8 | to create and use functions. This allows the development of specialized | 8 | to create and use functions. This allows the development of specialized |
9 | programs which can be integrated into the Scilab package in a simple and | 9 | programs which can be integrated into the Scilab package in a simple and |
10 | modular way through, for example, the use of libraries. In this chapter we | 10 | modular way through, for example, the use of libraries. In this chapter we |
11 | treat the following subjects: | 11 | treat the following subjects: |
12 | \begin{itemize} | 12 | \begin{itemize} |
13 | \item Programming Tools | 13 | \item Programming Tools |
14 | \item Defining and Using Functions | 14 | \item Defining and Using Functions |
15 | \item Definition of Operators for New Data Types | 15 | \item Definition of Operators for New Data Types |
16 | \item{Debbuging} | 16 | \item{Debbuging} |
17 | \end{itemize} | 17 | \end{itemize} |
18 | Creation of libraries is discussed in a later chapter. | 18 | Creation of libraries is discussed in a later chapter. |
19 | 19 | ||
20 | \section{Programming Tools} | 20 | \section{Programming Tools} |
21 | 21 | ||
22 | Scilab supports a full list of programming tools | 22 | Scilab supports a full list of programming tools |
23 | including loops, conditionals, case selection, | 23 | including loops, conditionals, case selection, |
24 | and creation of new environments. Most programming tasks | 24 | and creation of new environments. Most programming tasks |
25 | should be accomplished in the environment of a function. | 25 | should be accomplished in the environment of a function. |
@@ -98,7 +98,7 @@ matrices. The index takes as values the entries of the list. | |||
98 | str | 98 | str |
99 | \end{verbatim} | 99 | \end{verbatim} |
100 | 100 | ||
101 | The {\tt while} loop repeatedly performs a sequence of commands | 101 | The {\tt while} loop repeatedly performs a sequence of commands |
102 | until a condition is satisfied. | 102 | until a condition is satisfied. |
103 | \begin{verbatim} | 103 | \begin{verbatim} |
104 | --> x=1; while x<14,x=2*x,end | 104 | --> x=1; while x<14,x=2*x,end |
@@ -182,7 +182,7 @@ has the usual meaning and is a also a keyword recognized by the interpreter. | |||
182 | \end{verbatim} | 182 | \end{verbatim} |
183 | 183 | ||
184 | 184 | ||
185 | The {\tt select}-{\tt case} conditional | 185 | The {\tt select}-{\tt case} conditional |
186 | compares an expression to several possible expressions and performs the | 186 | compares an expression to several possible expressions and performs the |
187 | instructions following the first case which equals the initial expression. | 187 | instructions following the first case which equals the initial expression. |
188 | \begin{verbatim} | 188 | \begin{verbatim} |
@@ -206,7 +206,7 @@ where none of the cases are satisfied. | |||
206 | \index{functions} | 206 | \index{functions} |
207 | \index{functions!definition} | 207 | \index{functions!definition} |
208 | 208 | ||
209 | It is possible to define a function directly in | 209 | It is possible to define a function directly in |
210 | the Scilab environment, however, the most convenient way | 210 | the Scilab environment, however, the most convenient way |
211 | is to create a file containing the function | 211 | is to create a file containing the function |
212 | with a text editor. In this section we describe the | 212 | with a text editor. In this section we describe the |
@@ -380,16 +380,16 @@ Scilab has several special commands which are used almost exclusively | |||
380 | in functions. These are the commands | 380 | in functions. These are the commands |
381 | 381 | ||
382 | \begin{itemize} | 382 | \begin{itemize} |
383 | \item {\tt argn}\index{argn@{\tt argn}}: returns the number of input | 383 | \item {\tt argn}\index{argn@{\tt argn}}: returns the number of input |
384 | and output arguments for the function | 384 | and output arguments for the function |
385 | \item {\tt error}\index{error@{\tt error}}: used to suspend the | 385 | \item {\tt error}\index{error@{\tt error}}: used to suspend the |
386 | operation of a function, to print an error message, and to return to the | 386 | operation of a function, to print an error message, and to return to the |
387 | previous level of environment when an error is detected. | 387 | previous level of environment when an error is detected. |
388 | \item {\tt warning}\index{warning@{\tt warning}}, | 388 | \item {\tt warning}\index{warning@{\tt warning}}, |
389 | \item {\tt pause}\index{pause@{\tt pause}}: temporarily suspends the | 389 | \item {\tt pause}\index{pause@{\tt pause}}: temporarily suspends the |
390 | operation of a function. | 390 | operation of a function. |
391 | \item {\tt break}\index{break@{\tt break}}: forces the end of a loop | 391 | \item {\tt break}\index{break@{\tt break}}: forces the end of a loop |
392 | \item {\tt return}\index{return@{\tt return}} or {\tt resume} : used | 392 | \item {\tt return}\index{return@{\tt return}} or {\tt resume} : used |
393 | to return to the calling environment and to pass local | 393 | to return to the calling environment and to pass local |
394 | variables from the function environment to the calling environment. | 394 | variables from the function environment to the calling environment. |
395 | \end{itemize} | 395 | \end{itemize} |
@@ -455,7 +455,7 @@ the global environment. | |||
455 | \label{s4.3} | 455 | \label{s4.3} |
456 | \index{operations!for new data types} | 456 | \index{operations!for new data types} |
457 | 457 | ||
458 | It is possible to transparently define fundamental operations | 458 | It is possible to transparently define fundamental operations |
459 | for new data types in Scilab (enter {\tt help overloading} for | 459 | for new data types in Scilab (enter {\tt help overloading} for |
460 | a full description of this feature). | 460 | a full description of this feature). |
461 | That is, the user can give a sense to multiplication, division, addition, etc. | 461 | That is, the user can give a sense to multiplication, division, addition, etc. |
@@ -467,7 +467,7 @@ Scilab performs these user defined operations by searching for functions | |||
467 | (written by the user) which follow a special naming convention described | 467 | (written by the user) which follow a special naming convention described |
468 | below. | 468 | below. |
469 | 469 | ||
470 | The naming convention Scilab uses to recognize operators | 470 | The naming convention Scilab uses to recognize operators |
471 | defined by the user is determined by the following conventions. The name | 471 | defined by the user is determined by the following conventions. The name |
472 | of the user defined function is composed of four (or possibly three) | 472 | of the user defined function is composed of four (or possibly three) |
473 | fields. The first field is always the symbol {\tt \%}. | 473 | fields. The first field is always the symbol {\tt \%}. |
@@ -593,7 +593,7 @@ representing a linear system has the form: \\ | |||
593 | and, thus, the {\tt xxx} | 593 | and, thus, the {\tt xxx} |
594 | above is {\tt lss}. | 594 | above is {\tt lss}. |
595 | 595 | ||
596 | An example of the function name which multiplies two | 596 | An example of the function name which multiplies two |
597 | linear systems together (to represent their series inter-connection) | 597 | linear systems together (to represent their series inter-connection) |
598 | is {\tt \%lss\_m\_lss}. Here the first field is \%, the second field is | 598 | is {\tt \%lss\_m\_lss}. Here the first field is \%, the second field is |
599 | {\tt lss} (linear state-space), the third field is {\tt m} ``multiply'' | 599 | {\tt lss} (linear state-space), the third field is {\tt m} ``multiply'' |
diff --git a/scilab_doc/intro/chap4.tex b/scilab_doc/intro/chap4.tex index 2e998bc..8b90c50 100755 --- a/scilab_doc/intro/chap4.tex +++ b/scilab_doc/intro/chap4.tex | |||
@@ -1,5 +1,3 @@ | |||
1 | % Copyright INRIA | ||
2 | |||
3 | \chapter{Basic Primitives} | 1 | \chapter{Basic Primitives} |
4 | \label{ch5} | 2 | \label{ch5} |
5 | This chapter briefly describes some basic primitives of Scilab. | 3 | This chapter briefly describes some basic primitives of Scilab. |
@@ -125,6 +123,58 @@ mfprintf}\index{mfprintf@{\tt mfprintf}} can be also used | |||
125 | --> mclose(fd) | 123 | --> mclose(fd) |
126 | \end{verbatim} | 124 | \end{verbatim} |
127 | 125 | ||
126 | Here is a table of useful input-output functions: | ||
127 | |||
128 | \begin{center} | ||
129 | \begin{tabular}{|c|c|} | ||
130 | \hline | ||
131 | \verb!mprintf! & print in standard output\\ \hline | ||
132 | |||
133 | \verb!mfprintf! & print in a file\\ \hline | ||
134 | |||
135 | \verb!msprintf! & print in a string matrix \\ \hline | ||
136 | |||
137 | \verb!mscanf! & read in standard input \\ \hline | ||
138 | |||
139 | \verb!mfscanf! & read in a file \\ \hline | ||
140 | |||
141 | \verb!msscanf! & read in a string matrix \\ \hline | ||
142 | |||
143 | \verb!fprintfMat! & formated write a matrix into a file \\ \hline | ||
144 | |||
145 | \verb!fscanfMat! & formated read of a matrix in a file \\ \hline | ||
146 | |||
147 | \verb!mgetl! & read a file as a Scilab string matrix \\ \hline | ||
148 | |||
149 | \verb!mputl! & write a string matrix \\ \hline | ||
150 | |||
151 | \verb!mopen! & open a file \\ \hline | ||
152 | |||
153 | \verb!mclose! & close a file\\ \hline | ||
154 | \end{tabular} | ||
155 | \end{center} | ||
156 | |||
157 | To manipulate binary files, the following functions are available: | ||
158 | \begin{center} | ||
159 | \begin{tabular}{|c|c|} | ||
160 | \hline | ||
161 | \verb!mget! & read binary data\\ \hline | ||
162 | |||
163 | \verb!mput! & write binary data\\ \hline | ||
164 | |||
165 | \verb!mgetstr! & print in a string matrix \\ \hline | ||
166 | |||
167 | \verb!mputstr! & write a string matrix \\ \hline | ||
168 | |||
169 | \verb!mgetstr! & read in a file \\ \hline | ||
170 | |||
171 | \verb!mtell! & current position in a file\\ \hline | ||
172 | |||
173 | \verb!mseek! & move current position \\ \hline | ||
174 | |||
175 | \verb!meof! & end of file test \\ \hline | ||
176 | \end{tabular} | ||
177 | \end{center} | ||
128 | 178 | ||
129 | \section{Help} | 179 | \section{Help} |
130 | On-line help is available either by clicking on the | 180 | On-line help is available either by clicking on the |
@@ -156,25 +206,27 @@ can be obtained by entering {\tt help}. For each manual entry the | |||
156 | \begin{itemize} | 206 | \begin{itemize} |
157 | \item{Elementary functions: {\tt sum, prod, sqrt, diag, cos, max, round, sign, fft}} | 207 | \item{Elementary functions: {\tt sum, prod, sqrt, diag, cos, max, round, sign, fft}} |
158 | \item{Sorting: {\tt sort, gsort, find}} | 208 | \item{Sorting: {\tt sort, gsort, find}} |
159 | \item{Specific Matrices: {\tt zeros, eye, ones, matrix, empty}} | 209 | \item{Specific Matrices: {\tt zeros, eye, ones, matrix}} |
160 | \item{Linear Algebra: {\tt det, inv, qr, svd, bdiag, spec, schur}} | 210 | \item{Linear Algebra: {\tt det, inv, qr, svd, bdiag, spec, schur}} |
161 | \item{Polynomials}: {\tt poly, roots, coeff, horner, clean, freq} | 211 | \item{Polynomials}: {\tt poly, roots, coeff, horner, clean, freq} |
162 | \item{Buttons, dialog: \verb!x_choose, x_dialog, x_mdialog, getvalue, addmenu!} | 212 | \item{Buttons, dialog: \verb!x_choose, x_dialog, x_mdialog, getvalue, addmenu!} |
213 | \item{GUI (Tcl-tk): \verb!TK_EvalStr, TK_GetVar, TK_SetVar, TK_EvalFile!} | ||
163 | \item{Linear systems: {\tt syslin}} | 214 | \item{Linear systems: {\tt syslin}} |
164 | \item{Random numbers: {\tt rand}} | 215 | \item{Random numbers: {\tt rand}, {\tt grand}} |
165 | \item{Programming: {\tt function, deff, argn, for, if, end, while, | 216 | \item{Programming: {\tt function, deff, argn, for, if, end, while, |
166 | select, warning, error, break, return}} | 217 | select, warning, error, break, return}} |
167 | \item{Comparison symbols: {\tt ==}, {\tt >=}, {\tt >}, {\tt ~=}, {\verb!&!} | 218 | \item{Comparison symbols: {\tt ==}, {\tt >=}, {\tt >}, {\tt ~=}, {\verb!&!} |
168 | ({\tt and}),{\tt |} ({\tt or})} | 219 | ({\tt and}),{\tt |} ({\tt or})} |
169 | \item{Execution of a file: {\tt exec}} | 220 | \item{Execution of a file: {\tt exec}} |
170 | \item{Debugging: {\tt pause, return, abort}} | 221 | \item{Debugging: {\tt pause, return, abort}} |
171 | \item{Spline functions, interpolation: {\tt splin, interp, interpln}} | 222 | \item{Spline functions, interpolation: {\tt splin2d, interp2d, smooth, splin3d}} |
172 | \item{Character strings: {\tt string, part, evstr, execstr}} | 223 | \item{Character strings: {\tt string, part, evstr, execstr, grep}} |
173 | \item{Graphics: {\tt plot, xset, driver, plot2d, xgrid, locate, plot3d, Graphics}} | 224 | \item{Graphics: {\tt plot2d, set, get, xgrid, locate, plot3d, Graphics}} |
174 | \item{Ode solvers: {\tt ode, dassl, dassrt, odedc}} | 225 | \item{Ode solvers: {\tt ode, dassl, dassrt, odedc}} |
175 | \item{Optimization: {\tt optim, quapro, linpro, lmitool}} | 226 | \item{Optimization: {\tt optim, quapro, linpro, lmitool, lsqrsolve}} |
176 | \item{Interconnected dynamic systems: {\tt scicos}} | 227 | \item{Interconnected dynamic systems: {\tt scicos}} |
177 | \item{Adding a C or Fortran routine: {\tt link, fort, addinter, intersci}} | 228 | \item{Adding a C or Fortran routine: {\verb!link, call, addinter, ilib_for_link, ilib_build!}} |
229 | \item{Graphs, networks: {\verb! edit_graph, metanet!}} | ||
178 | \end{itemize} | 230 | \end{itemize} |
179 | 231 | ||
180 | 232 | ||
@@ -236,9 +288,6 @@ permanent manner by inserting it in a specific interface in | |||
236 | {\tt SCIDIR/routines/default} and rebuild a new Scilab by a | 288 | {\tt SCIDIR/routines/default} and rebuild a new Scilab by a |
237 | {\tt make all} command in the Scilab directory. | 289 | {\tt make all} command in the Scilab directory. |
238 | 290 | ||
239 | |||
240 | |||
241 | |||
242 | \section{XWindow Dialog} | 291 | \section{XWindow Dialog} |
243 | It may be convenient to open a specific XWindow window for entering | 292 | It may be convenient to open a specific XWindow window for entering |
244 | interactively parameters inside a function or for a demo. | 293 | interactively parameters inside a function or for a demo. |
@@ -253,3 +302,18 @@ A Graphic User Interface object can be created by the function | |||
253 | \verb!uicontrol!. Basic primitives are \verb!TK_EvalFile!, | 302 | \verb!uicontrol!. Basic primitives are \verb!TK_EvalFile!, |
254 | \verb!TK_EvalStr! and \verb! TK_GetVar, TK_Setvar!. Examples | 303 | \verb!TK_EvalStr! and \verb! TK_GetVar, TK_Setvar!. Examples |
255 | are given by invoking the help of these functions. | 304 | are given by invoking the help of these functions. |
305 | |||
306 | Let us give a simple dialog. We pass a script to TK as a Scilab | ||
307 | string matrix, TK opens a dialog box, and the result is returned | ||
308 | to Scilab as a string, using \verb!TK_GetVar!. | ||
309 | \begin{verbatim} | ||
310 | -->TK_script=["toplevel .dialog"; | ||
311 | "label .dialog.1 -text ""Enter your input\n here"""; | ||
312 | "pack .dialog.1"; | ||
313 | "entry .dialog.e -textvariable scivar"; | ||
314 | "set scivar """""; | ||
315 | "pack .dialog.e"]; | ||
316 | -->TK_EvalStr(TK_script); | ||
317 | -->text=TK_GetVar(scivar); | ||
318 | \end{verbatim} | ||
319 | |||
diff --git a/scilab_doc/intro/chap5.tex b/scilab_doc/intro/chap5.tex index 8404dca..52e30f9 100755 --- a/scilab_doc/intro/chap5.tex +++ b/scilab_doc/intro/chap5.tex | |||
@@ -1,1081 +1,329 @@ | |||
1 | % Copyright INRIA | 1 | \chapter{Graphics}\label{Graphics} |
2 | 2 | The graphics primitives in Scilab release 3.0 accept two graphic ``styles'', | |
3 | \chapter{Graphics} | 3 | the ``old'' style which is based on a pre-processing treatment |
4 | This section introduces graphics in Scilab. | 4 | and the ``new'' style, used by default, which is based on an object |
5 | 5 | oriented environment. | |
6 | \section{The Graphics Window} | 6 | |
7 | It is possible to use several graphics windows {\tt ScilabGraphicx} x being | 7 | These two styles are not fully compatible. To switch to the old style, |
8 | the number used for the management of the windows, but at any time only | 8 | use the command \verb!set old_style on!. |
9 | one window is active. On the main Scilab window the button | 9 | |
10 | {\tt Graphic Window x} is used to manage the windows : x denotes the | 10 | The old style mode is essentially based on two functions, |
11 | number of the active window, and we can set (create), raise or delete | 11 | {\tt xset} and {\tt xsetech} which act on the graphic environment. |
12 | the window numbered x : in particular we can directly create the | 12 | Once the graphic environment parameters are set, the graphic commands |
13 | graphics window numbered 10. | 13 | are used for plotting. |
14 | The execution of a plotting command automatically creates a window if | 14 | |
15 | necessary. | 15 | In the new style mode, once the plotting command is issued, it is |
16 | 16 | possible to act on the graphic environment by changing the | |
17 | We will see later that Scilab uses a {\tt graphics environment} | 17 | properties of the graphic objects made by the plot command. |
18 | defining some parameters of the plot, these parameters have default | 18 | The graphic environment is post-processed. |
19 | values and can be changed by the user; every graphics window has its | 19 | |
20 | specific context so the same plotting command van give different | 20 | %Nouvelles primitives |
21 | results on different windows. | 21 | %set get draw drawlater drawnow move copy delete glue unglue |
22 | 22 | %Nouvelles macros | |
23 | There are 4 buttons on the graphics window: | 23 | %gcf gca gdf gda sdf sda clearpixmap showpixmap |
24 | \begin{itemize} | 24 | |
25 | \item \verb+3D Rot.+: for applying a rotation with the mouse to a | 25 | %primitives obsolete pour le nouveau graphique |
26 | 3D plot. This button is inhibited for a 2D plot. For the help of | 26 | %xset (sauf 'window' et 'alufunction') |
27 | manipulations (rotation with specific angles ...) the rotation angles | 27 | %xget (sauf 'window' et 'alufunction') |
28 | are given at the top of the window. | 28 | %xtape xname xgrid replot isoview |
29 | \item \verb+2D Zoom+: zooming on a 2D plot. This command can be | 29 | |
30 | recursively invoked. For a 3D plot this button is not inhibited but it | 30 | Scilab graphics are based on a set a graphics functions such as {\tt plot2d}, |
31 | has no effect. | 31 | {\tt plot3d} \ldots and an object oriented graphic environment. |
32 | \item \verb+UnZoom+: return to the initial plot (not to the plot | 32 | The properties of the graphic objects (color, thickness, ...) are manipulated |
33 | corresponding to the previous zoom in case of multiple zooms). | 33 | with the functions {\tt get} and {\tt set}. The main graphic objects |
34 | 34 | are the figure entity and the axes entity. | |
35 | These 3 buttons affecting the plot in the window are not always in | 35 | We give here a description of the most useful functions illustrated by |
36 | use; we will see later that there are different choices for the | 36 | simple examples. For more sophisticated examples, it is necessary to read |
37 | underlying device and zoom and rotation need the record of the | 37 | the on-line help pages. The graphic demos are also useful and it is |
38 | plotting commands which is one of the possible choices (this is the | 38 | a good way to start. |
39 | default). | 39 | |
40 | 40 | \section{Function plot2d} | |
41 | 41 | The basic graphic function \index{plot2d@\scilab{plot2d}} used | |
42 | \item \verb+File+: this button opens different commands and menus. | 42 | for plotting one or several 2D curves is \scifun{plot2d}. |
43 | 43 | The simplest graphic command is \scilab{plot2d(x,y)} where | |
44 | The first one is simple : {\tt Clear} simply rubs out the window | 44 | x and y are two vectors with same dimension. |
45 | (without affecting the graphics context of the window). | 45 | This command gives the graph of the polyline which links each |
46 | 46 | point with coordinates \scilab{(x(i),y(i))} with the next point | |
47 | The command {\tt Print...} opens a selection panel for printing. | 47 | with coordinates \scilab{(x(i+1),y(i+1))}. The vectors |
48 | Under Unix, the printers are defined in the main scilab script | 48 | \scilab{x} et \scilab{y} must have at least two components. |
49 | {\tt SCIDIR/bin/scilab} (obtained by ``make all'' from the origin | 49 | The vector \scilab{x} can be omitted, its default value being |
50 | file {\tt SCIDIR/bin/scilab.g}). | 50 | \scilab{1:n} where \scilab{n} is the size of \scilab{y}. |
51 | 51 | \begin{figure} | |
52 | The {\tt Export} command opens a panel selection for getting a copy of the | 52 | \begin{center} |
53 | plot on a file with a specified format (Postscript, Postscript-Latex, Xfig). | 53 | %\includegraphics[width=10cm]{figures/graphique0.eps} |
54 | 54 | \includegraphics[width=10cm,height=7.6cm]{figures/f0.eps} | |
55 | The {\tt save} command directly saves the plot on a file with a | 55 | \end{center} |
56 | specified name. This file can be loaded later in Scilab for replotting. | 56 | \caption{A simple graph} |
57 | 57 | \label{f0} | |
58 | The {\tt Close} is the same command than the previous {\tt Delete | ||
59 | Graphic Window} of the menu of the main window, but simply | ||
60 | applied to its window (the graphic context is, of course deleted). | ||
61 | |||
62 | \end{itemize} | ||
63 | |||
64 | |||
65 | \section{The Media} | ||
66 | There are different graphics devices in Scilab which can be used to send | ||
67 | graphics to windows or paper. The default for the output is | ||
68 | \verb+ScilabGraphic0+ window . | ||
69 | |||
70 | \noindent The different drivers are: | ||
71 | |||
72 | % | ||
73 | \begin{itemize} | ||
74 | \item \verb+X11+ : memoryless screen graphics driver | ||
75 | \item \verb+Rec+ : a screen driver which also | ||
76 | records all the graphic commands. This is the default | ||
77 | (required for the zoom and rotate). | ||
78 | \item \verb+Wdp+ : a screen driver without recorded | ||
79 | graphics; the graphics are done on a pixmap and are send to | ||
80 | the graphic window with the command {\tt xset("wshow")}. The | ||
81 | pixmap is cleared with the command {\tt xset("wwpc")} or with the | ||
82 | usual command {\tt xbasc()} | ||
83 | \item \verb+Pos+ : graphics driver for Postscript printers | ||
84 | \item \verb+Fig+ : graphics driver for the Xfig system | ||
85 | \item \verb+GIF+ : graphics driver for the GIF file format | ||
86 | \end{itemize} | ||
87 | % | ||
88 | |||
89 | In the 3 first cases the 'implicit' device is a graphics window | ||
90 | (existing or created by the plot). For the 2 last cases we will see | ||
91 | later how to affect a specific device to the plot : a file where the | ||
92 | plot will be recorded in the Postscript or Xfig format. | ||
93 | |||
94 | The basic Scilab graphics commands are : | ||
95 | % | ||
96 | \begin{itemize} | ||
97 | \item \verb+driver+: selects a graphic driver | ||
98 | |||
99 | The next 3 commands are specific of the screen drivers : | ||
100 | |||
101 | \item \verb+xclear+: clears one or more graphic windows; does | ||
102 | not affect the graphics context of these windows. | ||
103 | \item \verb+xbasc+: clears a graphic window and erase the | ||
104 | recorded graphics; does not affect the graphics context of | ||
105 | the window. | ||
106 | \item \verb+xpause+: a pause in milliseconds | ||
107 | \item \verb+xselect+: raises the current graphic window | ||
108 | (for X-drivers) | ||
109 | \item \verb+xclick+: waits for a mouse click | ||
110 | \item \verb+xbasr+: redraws the plot of a graphic window | ||
111 | \item \verb+xdel+: deletes a graphic window (equivalent to the | ||
112 | {\tt Close} button | ||
113 | |||
114 | The following commands are specific of the Postscript, Xfig and GIF drivers | ||
115 | drivers : | ||
116 | |||
117 | \item \verb+xinit+: initializes a graphic device (file). | ||
118 | \item \verb+xend+: closes a graphic session (and the | ||
119 | associated device). | ||
120 | \end{itemize} | ||
121 | % | ||
122 | |||
123 | In fact, the regular driver for a common use is {\tt Rec} and there | ||
124 | are special commands in order to avoid a change of driver; in many | ||
125 | cases, one can ignore the existence of drivers and use the | ||
126 | functions \verb+xbasimp+, \verb+xs2fig+ in order to send a graphic | ||
127 | to a printer or in a file for the \verb+Xfig+ system. For example with | ||
128 | : | ||
129 | |||
130 | \begin{verbatim} | ||
131 | -->driver('Pos') | ||
132 | |||
133 | -->xinit('foo.ps') | ||
134 | |||
135 | -->plot(1:10) | ||
136 | |||
137 | -->xend() | ||
138 | |||
139 | -->driver('Rec') | ||
140 | |||
141 | -->plot(1:10) | ||
142 | |||
143 | -->xbasimp(0,'foo1.ps') | ||
144 | |||
145 | \end{verbatim} | ||
146 | |||
147 | \noindent we get two identical Postscript files : {\tt 'foo.ps'} and {\tt 'foo1.ps.0'} | ||
148 | (the appending 0 is the number of the active window where the plot has been | ||
149 | done). | ||
150 | |||
151 | The default for plotting is the superposition; this means that between | ||
152 | 2 different plots one of the 2 following command is needed: | ||
153 | {\tt xbasc(window-number)} which clears the window and erase the | ||
154 | recorded Scilab graphics command associated with the window | ||
155 | \verb+window-number+ or {\tt xclear}) which simply clears the window. | ||
156 | |||
157 | If you enlarge a graphic window, the command \verb+xbasr(window-number)+ | ||
158 | is executed by Scilab. This command clears the graphic window | ||
159 | \verb+window-number+ and replays the graphic commands associated with it. One | ||
160 | can call this function manually, in order to verify the associated | ||
161 | recorded graphics commands. | ||
162 | |||
163 | Any number of graphics windows can be created with buttons | ||
164 | or with the commands \verb+xset+ or \verb+xselect+. The environment | ||
165 | variable DISPLAY can be used to specify an X11 Display or one can use | ||
166 | the \verb+xinit+ function in order to open a graphic window on a | ||
167 | specific display. | ||
168 | |||
169 | \section{Global Parameters of a Plot} | ||
170 | \subsubsection{Graphics Context} | ||
171 | |||
172 | Some parameters of the graphics are controlled by a graphic context | ||
173 | ( for example the line thickness) and others are controlled through | ||
174 | graphics arguments of a plotting command. | ||
175 | The graphics context has a default definition and can be change by the | ||
176 | command {\tt xset} : the command without argument i.e. {\tt xset()} | ||
177 | opens the {\tt Scilab Toggles Panel} and the user can changes the | ||
178 | parameters by simple mouse clickings. We give here different | ||
179 | parameters controlled by this command : | ||
180 | % | ||
181 | \begin{itemize} | ||
182 | \item {\tt xset} : set graphic context values. | ||
183 | |||
184 | (i)-{\tt xset("font",fontid,fontsize)} : fix the current font and | ||
185 | its current size. | ||
186 | |||
187 | (ii)-{\tt xset("mark",markid,marksize)} : set the current mark | ||
188 | and current mark size. | ||
189 | |||
190 | (iii)-{\tt xset("use color",flag)} : change to color or gray plot according to | ||
191 | the values (1 or 0) of {\tt flag}. | ||
192 | |||
193 | (iv)-{\tt xset("colormap",cmap)} : set the colormap as a m x 3 | ||
194 | matrix. m is the number of colors. Color number i is given as a | ||
195 | 3-uple cmap[i,1],cmap[i,2], cmap[i,3] corresponding respectively to Red, | ||
196 | Green and Blue intensity between 0 and 1. Calling again {\tt xset()} | ||
197 | shows the colormap with the indices of the colors. | ||
198 | |||
199 | (v)-{\tt xset("window",window-number)} : sets the current window to the window \\ | ||
200 | {\tt window-number} and creates the window if it doesn't exist. | ||
201 | |||
202 | (vi)-{\tt xset("wpos",x,y)} : fixes the position of the upper left point of | ||
203 | the graphic window. | ||
204 | |||
205 | Many other choices are done by {\tt xset} : | ||
206 | |||
207 | -use of a pixmap : the plot can be directly displayed on the screen or | ||
208 | executed on a pixmap and then expose by the command | ||
209 | {\tt xset("wshow")}; this is the usual way for animation effect. | ||
210 | |||
211 | -logical function for drawing : this parameter can be changed for | ||
212 | specific effects (superposition or adding or substracting of colors). | ||
213 | Looking at the successive plots of the following simple commands give | ||
214 | an example of 2 possible effects of this parameter : | ||
215 | |||
216 | \begin{verbatim} | ||
217 | xset('default'); | ||
218 | plot3d(); | ||
219 | plot3d(); | ||
220 | xset('alufunction',7); | ||
221 | xset('window',0); | ||
222 | plot3d(); | ||
223 | xset('default'); | ||
224 | plot3d(); | ||
225 | xset('alufunction',6); | ||
226 | xset('window',0); | ||
227 | plot3d(); | ||
228 | \end{verbatim} | ||
229 | |||
230 | We have seen that some choices exist for the fonts and this choice can | ||
231 | be extended by the command: | ||
232 | \item {\tt xlfont} : to load a new family of fonts | ||
233 | |||
234 | |||
235 | There exists the function ``reciprocal'' to {\tt xset} : | ||
236 | |||
237 | \item {\tt xget} : to get informations about the | ||
238 | current graphic context. | ||
239 | |||
240 | All the values of the parameters fixed by {\tt xset} can be obtained by | ||
241 | {\tt xget}. An example : | ||
242 | |||
243 | \begin{verbatim} | ||
244 | |||
245 | -->pos=xget("wpos") | ||
246 | pos = | ||
247 | |||
248 | ! 105. 121. ! | ||
249 | |||
250 | \end{verbatim} | ||
251 | |||
252 | {\tt pos} is the position of the upper left point of the graphic window. | ||
253 | \end{itemize} | ||
254 | % | ||
255 | |||
256 | \subsubsection{Some Manipulations} | ||
257 | |||
258 | Coordinates transforms: | ||
259 | \begin{itemize} | ||
260 | |||
261 | \item \verb+isoview+ : isometric scale without window change | ||
262 | |||
263 | allows an isometric scale in the window of previous plots without changing | ||
264 | the window size: | ||
265 | |||
266 | \begin{verbatim} | ||
267 | |||
268 | t=(0:0.1:2*%pi)'; | ||
269 | plot2d(sin(t),cos(t)); | ||
270 | xbasc() | ||
271 | isoview(-1,1,-1,1); | ||
272 | plot2d(sin(t),cos(t)); | ||
273 | |||
274 | \end{verbatim} | ||
275 | |||
276 | \item \verb+square+ : isometric scale with resizing the window | ||
277 | |||
278 | the window is resized according to the parameters of the command. | ||
279 | |||
280 | \item \verb+scaling+ : scaling on data | ||
281 | \item \verb+rotate+ : rotation | ||
282 | |||
283 | \verb+scaling+ and \verb+rotate+ executes respectively an affine transform and | ||
284 | a geometric rotation of a 2-lines-matrix corresponding to the {\tt (x,y) } | ||
285 | values of a set of points. | ||
286 | \item \verb+xgetech, xsetech+ : change of scale inside the graphic window | ||
287 | |||
288 | The current graphic scale can be fixed by a high level plot command. You may | ||
289 | want to get this parameter or to fix it directly : this is the role of | ||
290 | \verb+xgetech, xsetech+ . {\tt xsetech } is a simple way to cut the | ||
291 | window in differents parts for different plots : | ||
292 | |||
293 | \begin{verbatim} | ||
294 | |||
295 | t=(0:0.1:2*%pi)'; | ||
296 | xsetech(wrect=[0.,0.,0.6,0.3],frect=[-1,1,-1,1]); | ||
297 | plot2d(sin(t),cos(t)); | ||
298 | xsetech(wrect=[0.5,0.3,0.4,0.6],frect=[-1,1,-1,1]); | ||
299 | plot2d(sin(t),cos(t)); | ||
300 | |||
301 | \end{verbatim} | ||
302 | |||
303 | \end{itemize} | ||
304 | % | ||
305 | |||
306 | |||
307 | \section{2D Plotting} | ||
308 | |||
309 | \subsection{Basic 2D Plotting} | ||
310 | |||
311 | The simplest 2D plot is {\tt plot(x,y)} or {\tt plot(y)}: this is the plot of | ||
312 | {\tt y} as function of {\tt x} where {\tt x} and {\tt y} are 2 vectors; if | ||
313 | {\tt x} is missing, it is replaced by the vector {\tt (1,size(y,'*')))}. | ||
314 | If {\tt y} is a matrix, its rows are plotted. There are optional arguments. | ||
315 | |||
316 | |||
317 | A first example is given by the following commands and one of the results is | ||
318 | represented on figure \ref{d7-1}: | ||
319 | |||
320 | \begin{verbatim} | ||
321 | |||
322 | t=(0:0.05:1)'; | ||
323 | ct=cos(2*%pi*t); | ||
324 | // plot the cosine | ||
325 | plot(t,ct); | ||
326 | // xset() opens the toggle panel and | ||
327 | // some parameters can be changed with mouse clicks | ||
328 | // given by commands for the demo here | ||
329 | xset("font",5,4);xset("thickness",3); | ||
330 | // plot with captions for the axis and a title for the plot | ||
331 | // if a caption is empty the argument ' ' is needed | ||
332 | plot(t,ct,'Time','Cosine','Simple Plot'); | ||
333 | // click on a color of the xset toggle panel and do the previous plot again | ||
334 | // to get the title in the chosen color | ||
335 | |||
336 | \end{verbatim} | ||
337 | |||
338 | \input{figures/d7-1.tex} | ||
339 | \caption{\label{d7-1}First example of plotting} | ||
340 | %\dessin{First example of plotting}{d7-1} | ||
341 | \end{figure} | 58 | \end{figure} |
342 | 59 | ||
343 | \noindent The generic 2D multiple plot is | 60 | Let us start with a simple example. Entering the commands |
344 | |||
345 | |||
346 | \noindent {\tt plot2di(x,y,<options>)} | ||
347 | |||
348 | \begin{itemize} | ||
349 | |||
350 | \item index of \verb+plot2d+ : {\tt i=missing,2,3,4}. | ||
351 | |||
352 | For the different values of {\tt i} we have: | ||
353 | |||
354 | {\tt i=missing} : piecewise linear/logarithmic plotting | ||
355 | |||
356 | {\tt i=2} : piecewise constant drawing style | ||
357 | |||
358 | {\tt i=3} : vertical bars | ||
359 | |||
360 | {\tt i=4} : arrows style (e.g. ode in a phase space) | ||
361 | |||
362 | \end{itemize} | ||
363 | |||
364 | \begin{verbatim} | ||
365 | t=(1:0.1:8)';xset("font",2,3); | ||
366 | subplot(2,2,1) | ||
367 | plot2d([t t],[1.5+0.2*sin(t) 2+cos(t)]); | ||
368 | xtitle('Plot2d-Piecewise linear'); | ||
369 | // | ||
370 | subplot(2,2,2) | ||
371 | plot2d(t,[1.5+0.2*sin(t) 2+cos(t)],logflag='ll'); | ||
372 | xtitle('Plot2d1-Logarithmic scales'); | ||
373 | // | ||
374 | subplot(2,2,3) | ||
375 | plot2d2(t,[1.5+0.2*sin(t) 2+cos(t)]); | ||
376 | xtitle('Plot2d2-Piecewise constant'); | ||
377 | // | ||
378 | subplot(2,2,4) | ||
379 | plot2d3(t,[1.5+0.2*sin(t) 2+cos(t)]); | ||
380 | xtitle('Plot2d3-Vertical bar plot') | ||
381 | \end{verbatim} | ||
382 | |||
383 | \input{figures/nouv1.tex} | ||
384 | |||
385 | \begin{itemize} | ||
386 | |||
387 | |||
388 | \item Parameters {\tt x,y} : two matrices of the same size {\tt [nl,nc]} ({\tt nc} | ||
389 | is the number of curves and {\tt nl} is the number of points of each | ||
390 | curve). | ||
391 | |||
392 | For a single curve the vector can be row or column: \\ | ||
393 | {\tt plot2d(t',cos(t)') plot2d(t,cos(t))} are equivalent. | ||
394 | |||
395 | |||
396 | \item option {\tt style} :it is a real vector of size {\tt | ||
397 | (1,nc)}; the style | ||
398 | to use for curve j is defined by {\tt size(j)} (when only one curve is drawn | ||
399 | {\tt style} can specify the style and a position to use for the | ||
400 | caption). | ||
401 | |||
402 | \begin{verbatim} | ||
403 | xmax=5.;x=0:0.1:xmax; | ||
404 | u=[-0.8+sin(x);-0.6+sin(x);-0.4+sin(x);-0.2+sin(x);sin(x)]; | ||
405 | u=[u;0.2+sin(x);0.4+sin(x);0.6+sin(x);0.8+sin(x)]'; | ||
406 | //start trying the symbols (negative values for the style) | ||
407 | |||
408 | plot2d(x,u,style=[-9,-8,-7,-6,-5,-4,-3,-2,-1,0]) | ||
409 | |||
410 | x=0:0.2:xmax; | ||
411 | v=[1.4+sin(x);1.8+sin(x)]'; | ||
412 | xset("mark size",5); | ||
413 | plot2d(x,v,style=[-7,-8]) | ||
414 | xset('default'); | ||
415 | \end{verbatim} | ||
416 | |||
417 | \input{figures/nouv2.tex} | ||
418 | |||
419 | \item Option {\tt frameflag} : is a scalar corresponding to : | ||
420 | |||
421 | \begin{tabular}{|l|l|l|l|} \hline | ||
422 | requirements&ranges &ranges &ranges \\ | ||
423 | &of a previous&given by &computed from\\ | ||
424 | actual &plot &rect arg &x and y \\ \hline | ||
425 | requested & & & \\ | ||
426 | one & 0 & 1 & 2 \\ \hline | ||
427 | Computed & & & \\ | ||
428 | for isometric & & 3 & 4 \\ | ||
429 | view & & & \\ \hline | ||
430 | Enlarged & & & \\ | ||
431 | For pretty & & 5 & 6 \\ | ||
432 | axes & & & \\ \hline | ||
433 | Previous and & & & \\ | ||
434 | current & & 7 & 8 \\ | ||
435 | plots merged & & & \\ \hline | ||
436 | \end{tabular} | ||
437 | \item Option {\tt axesflag} controls the display of information on the frame around the plot : | ||
438 | \begin{itemize} | ||
439 | \item 0 | ||
440 | : | ||
441 | nothing is drawn around the plot. | ||
442 | \item 1 | ||
443 | : | ||
444 | axes are drawn, the y=axis is displayed on the left. | ||
445 | \item 2 | ||
446 | : | ||
447 | the plot is surrounded by a box without tics. | ||
448 | \item 3 | ||
449 | : | ||
450 | axes are drawn, the y=axis is displayed on the right. | ||
451 | \item 4 | ||
452 | : | ||
453 | axes are drawn centred in the middle of the frame box. | ||
454 | |||
455 | \item 5 | ||
456 | : | ||
457 | axes are drawn so as to cross at point {\tt (0,0)}. If point | ||
458 | {\tt (0,0)} does not lie inside the frame, axes will not appear on the graph. | ||
459 | \end{itemize} | ||
460 | |||
461 | \item Option {\tt leg } : it is the string of the captions for the different | ||
462 | plotted curves . This string is composed of fields separated by the {\tt @} | ||
463 | symbol: for example {\tt ``module@phase''} (see example below). These | ||
464 | strings are | ||
465 | displayed under the plot with small segments recalling the styles of the | ||
466 | corresponding curves. | ||
467 | |||
468 | \item Option {\tt rect } : it is a vector of 4 values specifying the boundaries | ||
469 | of the plot {\tt rect=[xmin,ymin,xmax,ymax]}. | ||
470 | |||
471 | \item Option {\tt nax } : it is a vector [nx,Nx,ny,Ny] where nx (ny) is | ||
472 | the number of subgrads on the x (y) axis and Nx (Ny) is the number of | ||
473 | graduations on the x (y) axis. | ||
474 | |||
475 | \end{itemize} | ||
476 | |||
477 | \begin{verbatim} | ||
478 | |||
479 | //captions for identifying the curves | ||
480 | //controlling the boundaries of the plot and the tics on axes | ||
481 | x=-5:0.1:5; | ||
482 | y1=sin(x);y2=cos(x); | ||
483 | X=[x;x]; Y=[y1;y2]; | ||
484 | plot2d(X',Y',style=[-1 -3]',leg="caption1@caption2",... | ||
485 | rect=[-5,-1,5,1],nax=[2,10,5,5]); | ||
486 | |||
487 | \end{verbatim} | ||
488 | |||
489 | \input{figures/nouv3.tex} | ||
490 | |||
491 | |||
492 | For different plots the simple commands without any argument show a demo | ||
493 | (e.g {\tt plot2d3()} ). | ||
494 | |||
495 | \subsection{Captions and Presentation} | ||
496 | % | ||
497 | \begin{itemize} | ||
498 | \item \verb+xgrid+ : adds a grid on a 2D graphic; the | ||
499 | calling parameter is the number of the color. | ||
500 | \item \verb+xtitle+ : adds title above the plot and axis | ||
501 | names on a 2D graphic | ||
502 | \item \verb+titlepage+ : graphic title page in the middle of | ||
503 | the plot | ||
504 | |||
505 | \begin{verbatim} | ||
506 | |||
507 | //Presentation | ||
508 | x=-%pi:0.1:%pi; | ||
509 | y1=sin(x);y2=cos(x);y3=x; | ||
510 | X=[x;x;x]; Y=[y1;y2;y3]; | ||
511 | plot2d(X',Y',style=[-1 -2 -3],leg="caption1@caption2@caption3",... | ||
512 | rect=[-3,-3,3,2],nax=[2,10,2,5]); | ||
513 | xtitle(["General Title";"(with xtitle command)"],... | ||
514 | "x-axis title","y-axis title (with xtitle command)"); | ||
515 | xgrid(); | ||
516 | xclea(-2.7,1.5,1.5,1.5); | ||
517 | titlepage("Titlepage"); | ||
518 | xstring(0.6,.45,"(with titlepage command)"); | ||
519 | xstring(0.05,.7,["xstring command after";"xclea command"],0,1); | ||
520 | plot2d(X',Y',style=[-1 -2 -3],leg="caption1@caption2@caption3",... | ||
521 | rect=[-3,-3,3,2],nax=[2,10,2,5]); | ||
522 | |||
523 | \end{verbatim} | ||
524 | |||
525 | \input{figures/nouv4.tex} | ||
526 | |||
527 | |||
528 | \item \verb+plotframe+ : graphic frame with scaling and grid | ||
529 | \end{itemize} | ||
530 | % | ||
531 | |||
532 | We have seen that it is possible to control the tics on the axes, | ||
533 | choose the size of the rectangle for the plotand add a grid. | ||
534 | This operation can be prepared once and then used for a sequence of | ||
535 | different plots. One of the most useful aspect is to get graduations | ||
536 | by choosing the number of graduations and getting rounded numbers. | ||
537 | |||
538 | \begin{verbatim} | 61 | \begin{verbatim} |
539 | 62 | -->x=linspace(0,2*%pi,100);plot2d(x,sin(x)) | |
540 | rect=[-%pi,-1,%pi,1]; | ||
541 | tics=[2,10,4,10]; | ||
542 | plotframe(rect,tics,[%t,%t],... | ||
543 | ['Plot with grids and automatic bounds','angle','velocity']); | ||
544 | |||
545 | \end{verbatim} | 63 | \end{verbatim} |
546 | 64 | opens a graphic window and produces a graph of the sine function | |
547 | \begin{itemize} | 65 | for 100 values of x equally spaced between 0 and $2 \pi$. |
548 | \item \verb+graduate+ : a simple tool for computing pretty | 66 | The \scilab{plot2d} command opens a graphic window |
549 | axis graduations before a plot. | 67 | (see figure \ref{f0}) in which the plot appears. |
550 | \end{itemize} | 68 | The graph is plotted in a rectangular frame and the bottom and left |
551 | % | 69 | sides are used for axes with ticks. |
552 | 70 | ||
553 | \subsection{Specialized 2D Plottings} | 71 | By default, \scifun{plot2d} does not erase the graphic window, but |
554 | % | 72 | the plot is made in the current windows, which possibly contains older |
555 | \begin{itemize} | 73 | plots. Thus, if after the preceding command the following is entered~: |
556 | \item \verb+champ+ : vector field in $R^{2}$ | ||
557 | |||
558 | \begin{verbatim} | 74 | \begin{verbatim} |
559 | //try champ | 75 | t=linspace(0,4*%pi,100);plot2d(t,0.5*cos(t)) |
560 | x=[-1:0.1:1];y=x;u=ones(x); | ||
561 | fx=x.*.u';fy=u.*.y'; | ||
562 | champ(x,y,fx,fy); | ||
563 | xset("font",2,3); | ||
564 | xtitle(['Vector field plot';'(with champ command)']); | ||
565 | //with the color (and a large stacksize) | ||
566 | x=[-1:0.004:1];y=x;u=ones(x); | ||
567 | fx=x.*.u';fy=u.*.y'; | ||
568 | champ1(x,y,fx,fy); | ||
569 | \end{verbatim} | 76 | \end{verbatim} |
77 | \noindent we get figure \ref{g0}) in which the graph of th | ||
78 | two functions, sine and cosine, appear with a common x axis. | ||
79 | (note that the x-axis goes from $0$ to $4\pi$ after the second | ||
80 | plot command). | ||
81 | \begin{figure} | ||
82 | \begin{center} | ||
83 | %\includegraphics[width=10cm]{figures/graphique0.eps} | ||
84 | %\includegraphics[width=10cm]{figures/gg.eps} | ||
85 | \includegraphics[width=10cm]{figures/f1.eps} | ||
86 | \end{center} | ||
87 | \caption{Two plots: superposing curves}\label{g0} | ||
88 | \end{figure} | ||
570 | 89 | ||
571 | \input{figures/nouv5.tex} | 90 | To clear the graphic window, the command \scifun{xbasc()} should be |
572 | 91 | used or just click the \scifun{Clear} button of the \scifun{File} menu. | |
573 | |||
574 | |||
575 | \item \verb+fchamp+ : for a vector field in $R^{2}$ defined by a | ||
576 | function. The same plot than {\tt champ} for a vector field defined | ||
577 | for example by a scilab program. | ||
578 | |||
579 | \item \verb+fplot2d+ : 2D plotting of a curve described by a | ||
580 | function. This function plays the same role for {\tt plot2d} than the | ||
581 | previous for {\tt champ}. | ||
582 | |||
583 | \item \verb+grayplot+ : 2D plot of a surface using gray | ||
584 | levels; the surface being defined by the matrix of the values | ||
585 | for a grid. | ||
586 | |||
587 | \item \verb+fgrayplot+ : the same than the previous for a | ||
588 | surface defined by a function (scilab program). | ||
589 | 92 | ||
590 | In fact these 2 functions can be replaced by a usual color plot with | 93 | Using the standard menus, it is possible to zoom a part of the graph or |
591 | an appropriate colormap where the 3 RGB components are the same. | 94 | to export the graphic window into a file or to see the 2D plot in a |
95 | 3D figure. Menus can be interactively | ||
96 | added or removed, using \scifun{delmenu} \scifun{addmenu} functions. | ||
592 | 97 | ||
98 | Parameters such as the color or the thickness of the frame can be | ||
99 | given to the {\tt plot2d} function. Note that the graphic parameters are | ||
100 | given to {\tt plot2d} with a particular syntax. For instance to select a | ||
101 | color or a line style we can use the ``style'' keyword inside the plot2d | ||
102 | command as follows: | ||
593 | \begin{verbatim} | 103 | \begin{verbatim} |
594 | R=[1:256]/256;RGB=[R' R' R']; | 104 | -->plot2d(x,y,style=5) //5 means ``red'' |
595 | xset('colormap',RGB); | ||
596 | deff('[z]=surf(x,y)','z=-((abs(x)-1)**2+(abs(y)-1)**2)'); | ||
597 | fgrayplot(-1.8:0.02:1.8,-1.8:0.02:1.8,surf,rect=[-2,-2,2,2]); | ||
598 | xset('font',2,3); | ||
599 | xtitle(["Grayplot";"(with fgrayplot command)"]); | ||
600 | //the same plot can be done with a ``unique'' given color | ||
601 | R=[1:256]/256; | ||
602 | G=0.1*ones(R); | ||
603 | RGB=[R' G' G']; | ||
604 | xset('colormap',RGB); | ||
605 | fgrayplot(-1.8:0.02:1.8,-1.8:0.02:1.8,surf,rect=[-2,-2,2,2]); | ||
606 | \end{verbatim} | 105 | \end{verbatim} |
607 | 106 | ||
608 | %\input{figures/nouv6.tex} | 107 | The basic properties of a figure can be accessed by clicking on the {\tt Edit} |
609 | %\dessin{Gray plot with a gray colormap}{nouv6} | 108 | button of the graphic window. For instance to select a particular color |
610 | 109 | (as done with style=5 before) we can use the command | |
611 | \item \verb+errbar+ : creates a plot with error bars | ||
612 | \end{itemize} | ||
613 | % | ||
614 | |||
615 | |||
616 | \subsection{Plotting Some Geometric Figures} | ||
617 | \subsubsection{Polylines Plotting} | ||
618 | \begin{itemize} | ||
619 | \item \verb+xsegs+ : draws a set of unconnected segments | ||
620 | \item \verb+xrect+ : draws a single rectangle | ||
621 | \item \verb+xfrect+ : fills a single rectangle | ||
622 | \item \verb+xrects+ : fills or draws a set of rectangles | ||
623 | \item \verb+xpoly+ : draws a polyline | ||
624 | \item \verb+xpolys+ : draws a set of polylines | ||
625 | \item \verb+xfpoly+ : fills a polygon | ||
626 | \item \verb+xfpolys+ : fills a set of polygons | ||
627 | \item \verb+xarrows+ : draws a set of unconnected arrows | ||
628 | \item \verb+xfrect+ : fills a single rectangle | ||
629 | \item \verb+xclea+ : erases a rectangle on a graphic window | ||
630 | \end{itemize} | ||
631 | % | ||
632 | |||
633 | \subsubsection{Curves Plotting} | ||
634 | \begin{itemize} | ||
635 | \item \verb+xarc+ : draws an ellipsis | ||
636 | \item \verb+xfarc+ : fills an ellipsis | ||
637 | \item \verb+xarcs+ : fills or draws a set of ellipsis | ||
638 | \end{itemize} | ||
639 | % | ||
640 | |||
641 | \subsection{ Writting by Plotting} | ||
642 | % | ||
643 | \begin{itemize} | ||
644 | \item \verb+xstring+ : draws a string or a matrix of strings | ||
645 | \item \verb+xstringl+ : computes a rectangle which surrounds | ||
646 | a string | ||
647 | \item \verb+xstringb+ : draws a string in a specified box | ||
648 | \item \verb+xnumb+ : draws a set of numbers | ||
649 | \end{itemize} | ||
650 | % | ||
651 | |||
652 | We give now the sequence of the commands for obtaining the | ||
653 | figure~ \ref{fgeom}. | ||
654 | |||
655 | \begin{verbatim} | 110 | \begin{verbatim} |
656 | // initialize default environment variables | 111 | -->plot2d(x,y) |
657 | xset('default'); | ||
658 | xset("use color",0); | ||
659 | xset("font",4,3) | ||
660 | xsetech(frect=[1,1,10,10]); | ||
661 | xrect(0,1,3,1) | ||
662 | xfrect(3.1,1,3,1) | ||
663 | xstring(0.5,0.5,"xrect(0,1,3,1)") | ||
664 | xstring(4.,0.5,"xfrect(3.1,1,3,1)") | ||
665 | xset("alufunction",6) | ||
666 | xstring(4.,0.5,"xfrect(3.1,1,3,1)") | ||
667 | xset("alufunction",3) | ||
668 | xv=[0 1 2 3 4] | ||
669 | yv=[2.5 1.5 1.8 1.3 2.5] | ||
670 | xpoly(xv,yv,"lines",1) | ||
671 | xstring(0.5,2.,"xpoly(xv,yv,""lines"",1)") | ||
672 | xa=[5 6 6 7 7 8 8 9 9 5] | ||
673 | ya=[2.5 1.5 1.5 1.8 1.8 1.3 1.3 2.5 2.5 2.5] | ||
674 | xarrows(xa,ya) | ||
675 | xstring(5.5,2.,"xarrows(xa,ya)") | ||
676 | xarc(0.,5.,4.,2.,0.,64*300.) | ||
677 | xstring(0.5,4,"xarc(0.,5.,4.,2.,0.,64*300.)") | ||
678 | xfarc(5.,5.,4.,2.,0.,64*360.) | ||
679 | //xset("alufunction",6) | ||
680 | xclea(5.6,4.4,2.8,0.8); | ||
681 | xstring(5.8,4.,"xfarc and then xclea") | ||
682 | //xset("alufunction",3) | ||
683 | xstring(0.,4.5,"WRITING-BY-XSTRING()",-22.5) | ||
684 | xnumb([5.5 6.2 6.9],[5.5 5.5 5.5],[3 14 15],1) | ||
685 | isoview(0,12,0,12) | ||
686 | xarc(-5.,12.,5.,5.,0.,64*360.) | ||
687 | xstring(-4.5,9.25,"isoview + xarc",0.) | ||
688 | A=[" 1" " 2" " 3";" 4" " 5" " 6";"68" " 17.2" " 9"]; | ||
689 | xstring(7.,10.,A); | ||
690 | rect=xstringl(7,10,A); | ||
691 | xrect(rect(1),rect(2),rect(3),rect(4)); | ||
692 | \end{verbatim} | 112 | \end{verbatim} |
113 | and select the {\tt Start entity picker} item of the {\tt Edit} button, then | ||
114 | click on the curve, select a particular color and finally select the | ||
115 | {\tt Stop entity picker} item. | ||
693 | 116 | ||
694 | \input{figures/nouv7.tex} | 117 | \section{Figure, axes, etc} |
695 | 118 | Once a graphic command has been issued, the properties of the figure | |
696 | 119 | obtained are retrieved by the command | |
697 | e have seen that some parameters of the graphics are controlled by a | ||
698 | graphic context | ||
699 | ( for example the line thickness) and others are controlled through | ||
700 | graphics arguments . | ||
701 | % | ||
702 | \begin{itemize} | ||
703 | \item {\tt xset} : to set graphic context values. | ||
704 | Some examples of the use of {\tt xset} : | ||
705 | |||
706 | (i)-{\tt xset("use color",flag)} changes to color or black and white plot according to | ||
707 | the values (1 or 0) of {\tt flag}. | ||
708 | |||
709 | (ii)-{\tt xset("window",window-number)} sets the current window to the window \\ | ||
710 | {\tt window-number} and creates the window if it doesn't exist. | ||
711 | |||
712 | (iii)-{\tt xset("wpos",x,y)} fixes the position of the upper left point of | ||
713 | the graphic window. | ||
714 | |||
715 | The choice of the font, the width and height of the window, the driver... | ||
716 | can be done by {\tt xset}. | ||
717 | |||
718 | \item {\tt xget} : to get informations about the current graphic context. | ||
719 | All the values of the parameters fixed by {\tt xset} can be obtained by | ||
720 | {\tt xget}. | ||
721 | |||
722 | \item {\tt xlfont} : to load a new family of fonts | ||
723 | \end{itemize} | ||
724 | % | ||
725 | \subsection{Some Classical Graphics for Automatic Control} | ||
726 | |||
727 | \begin{itemize} | ||
728 | |||
729 | \item \verb+bode+ : plot magnitude and phase of the | ||
730 | frequency response of a linear system. | ||
731 | |||
732 | \item \verb+gainplot+ : same as bode but plots only the | ||
733 | magnitude of the frequency response. | ||
734 | |||
735 | \item \verb+nyquist+ : plot of imaginary part versus real | ||
736 | part of the frequency response of a linear system. | ||
737 | |||
738 | \item \verb+m_circle+ : M-circle plot used with nyquist plot. | ||
739 | |||
740 | \item \verb+chart+ : plot the Nichols'chart | ||
741 | |||
742 | \item \verb+black+ : plot the Black's diagram (Nichols'chart) | ||
743 | for a linear system. | ||
744 | |||
745 | \item \verb+evans+ : plot the Evans root locus for a | ||
746 | linear system. | ||
747 | |||
748 | \item \verb+plzr+ : pole-zero plot of the linear system | ||
749 | |||
750 | \end{itemize} | ||
751 | |||
752 | \begin{verbatim} | 120 | \begin{verbatim} |
753 | s=poly(0,'s'); | 121 | -->f=gcf() |
754 | h=syslin('c',(s^2+2*0.9*10*s+100)/(s^2+2*0.3*10.1*s+102.01)); | ||
755 | h1=h*syslin('c',(s^2+2*0.1*15.1*s+228.01)/(s^2+2*0.9*15*s+225)); | ||
756 | //bode | ||
757 | subplot(2,2,1) | ||
758 | gainplot([h1;h],0.01,100); | ||
759 | //nyquist | ||
760 | subplot(2,2,2) | ||
761 | nyquist([h1;h]) | ||
762 | |||
763 | //chart and black | ||
764 | subplot(2,2,3) | ||
765 | black([h1;h],0.01,100,['h1';'h']) | ||
766 | chart([-8 -6 -4],[80 120],list(1,0)); | ||
767 | //evans | ||
768 | subplot(2,2,4) | ||
769 | H=syslin('c',352*poly(-5,'s')/poly([0,0,2000,200,25,1],'s','c')); | ||
770 | evans(H,100) | ||
771 | \end{verbatim} | 122 | \end{verbatim} |
772 | 123 | Here {\tt f} is a handle which describes the figure properties. | |
773 | \input{figures/nouv8.tex} | 124 | It has many fields which can be modified to change the properties |
774 | 125 | of the figure. | |
775 | 126 | For instance, issuing | |
776 | % | ||
777 | \subsection{Miscellaneous} | ||
778 | % | ||
779 | \begin{itemize} | ||
780 | \item \verb+edit_curv+ : interactive graphic curve editor. | ||
781 | |||
782 | \item \verb+gr_menu+ : simple interactive graphic editor. It | ||
783 | is a Xfig-like simple editor with a flexible use for a nice | ||
784 | presentation of graphics : the user can superpose the elements of | ||
785 | \verb+gr_menu+ and use it with the usual possibilities of {\tt xset}. | ||
786 | |||
787 | \item \verb+locate+ : to get the coordinates of one or more | ||
788 | points selected with the mouse on a graphic window. | ||
789 | |||
790 | \end{itemize} | ||
791 | % | ||
792 | |||
793 | \begin{verbatim} | 127 | \begin{verbatim} |
794 | 128 | -->f.figure_name='My figure' | |
795 | \end{verbatim} | 129 | \end{verbatim} |
796 | \input{figures/scifi2.tex} | 130 | will modify the \verb!figure_name! field and change the name of the |
797 | 131 | figure which appears in the current graphic window. | |
798 | |||
799 | |||
800 | \section{3D Plotting} | ||
801 | \subsection{Generic 3D Plotting} | ||
802 | % | ||
803 | \begin{itemize} | ||
804 | \item \verb+plot3d+ : 3D plotting of a matrix of points : plot3d(x,y,z) with x,y,z 3 matrices, z being the values for the points with coordinates x,y. Other | ||
805 | arguments are optional | ||
806 | \item \verb+plot3d1+ : 3d plotting of a matrix of points with gray levels | ||
807 | \item \verb+fplot3d+ : 3d plotting of a surface described by a function; z is given by an external z=f(x,y) | ||
808 | \item \verb+fplot3d1+ : 3d plotting of a surface described by a function with gray levels | ||
809 | \end{itemize} | ||
810 | % | ||
811 | |||
812 | \subsection{Specialized 3D Plotting} | ||
813 | \begin{itemize} | ||
814 | \item \verb+param3d+ : plots parametric curves in 3d space | ||
815 | \item \verb+contour+ : level curves for a 3d function given by a | ||
816 | matrix | ||
817 | \item \verb+grayplot10+ : gray level on a 2d plot | ||
818 | \item \verb+fcontour10+ : level curves for a 3d function given by a | ||
819 | function | ||
820 | \item \verb+hist3d+ : 3d histogram | ||
821 | \item \verb+secto3d+ : conversion of a surface description from | ||
822 | sector to plot3d compatible data | ||
823 | \item \verb+eval3d+ : evaluates a function on a regular grid. | ||
824 | (see also feval) | ||
825 | \end{itemize} | ||
826 | % | ||
827 | |||
828 | |||
829 | \subsection{Mixing 2D and 3D graphics} | ||
830 | |||
831 | When one uses 3D plotting function, default graphic boundaries are | ||
832 | fixed, but in $R^3$. If one wants to use graphic primitives | ||
833 | to add informations on 3D graphics, the \verb+geom3d+ function can be | ||
834 | used to convert 3D coordinates to 2D-graphics coordinates. The | ||
835 | figure~ \ref{d710} illustrates this feature. | ||
836 | |||
837 | %\def\exemple{d710} | ||
838 | \input{figures/d7-10.vtex} | ||
839 | |||
840 | \input{figures/d710.tex} | ||
841 | |||
842 | |||
843 | \subsection{Sub-windows} | ||
844 | %\def\exemple{d7-8} | ||
845 | 132 | ||
846 | It is also possible to make multiple plotting in the same | 133 | The handle {\tt f} has a field called ``children'' which is an handle |
847 | graphic window (Figure~\ref{d7-8}). | 134 | descrining the properties of the axes of the figure. |
848 | |||
849 | \input{figures/d7-8.vtex} | ||
850 | |||
851 | \input{figures/d7-8.tex} | ||
852 | \caption{\label{d7-8}Use of subplot} | ||
853 | \end{figure} | ||
854 | |||
855 | |||
856 | \subsection{A Set of Figures} | ||
857 | %\def\exemple{d7a11} | ||
858 | |||
859 | In this next example we give a brief summary of different plotting | ||
860 | functions for 2D or 3D graphics. The figure~ \ref{d7a11} is | ||
861 | obtained and inserted in this document with the help of the command | ||
862 | \verb+Blatexprs+. | ||
863 | |||
864 | \input{figures/d7a11.vtex} | ||
865 | |||
866 | \input{figures/d7a11.tex} | ||
867 | \caption{\label{d7a11}Group of figures} | ||
868 | \end{figure} | ||
869 | |||
870 | \section{Printing and Inserting Scilab Graphics in \LaTeX} | ||
871 | |||
872 | We describe here the use of programs (Unix shells) for handling Scilab | ||
873 | graphics and printing the results. These programs are located in the | ||
874 | sub-directory {\tt bin} of Scilab. | ||
875 | |||
876 | \subsection{Window to Paper} | ||
877 | The simplest command to get a paper copy of a plot is to click on the | ||
878 | {\tt print} button of the ScilabGraphic window. | ||
879 | |||
880 | \subsection{Creating a Postscript File} | ||
881 | We have seen at the beginning of this chapter that the simplest way to get | ||
882 | a Postscript file containing a Scilab plot is : | ||
883 | |||
884 | \begin{verbatim} | ||
885 | -->driver('Pos') | ||
886 | |||
887 | -->xinit('foo.ps') | ||
888 | |||
889 | -->plot3d1(); | ||
890 | |||
891 | -->xend() | ||
892 | |||
893 | -->driver('Rec') | ||
894 | |||
895 | -->plot3d1() | ||
896 | |||
897 | -->xbasimp(0,'foo1.ps') | ||
898 | |||
899 | \end{verbatim} | ||
900 | |||
901 | |||
902 | The Postscript files ({\tt foo.ps } or {\tt foo1.ps }) generated by Scilab | ||
903 | cannot be directly sent to a | ||
904 | Postscript printer, they need a preamble. Therefore, printing is done | ||
905 | through the use of Unix scripts or programs which are provided with | ||
906 | Scilab. The program \verb+Blpr+ is used to print a set of Scilab Graphics | ||
907 | on a single sheet of paper and is used as follows~: | ||
908 | |||
909 | \begin{verbatim} | ||
910 | Blpr string-title file1.ps file2.ps > result | ||
911 | \end{verbatim} | ||
912 | |||
913 | You can then print the file {\tt result} with the classical Unix command : | ||
914 | 135 | ||
136 | Assume now that we have plotted a graph by the | ||
137 | {\tt plot2d(x,y)} command want add a title to the graph obtained. | ||
138 | The handle associated with the figure is \verb!f=gcf()!. | ||
139 | To access to the properties of the axes of the figure one can enter | ||
915 | \begin{verbatim} | 140 | \begin{verbatim} |
916 | lpr -Pprinter-name result | 141 | -->a=f.children |
917 | \end{verbatim} | 142 | \end{verbatim} |
918 | 143 | and we see that the handle {\tt a} has a field named ``title''. | |
919 | \noindent or use the \verb+ghostview+ Postscript interpreter on your Unix | 144 | Now if we enter |
920 | workstation to see the result. | ||
921 | |||
922 | You can avoid the file {\tt result} with a pipe, replacing {\tt > result} | ||
923 | by the printing command {\tt | lpr} or the previewing command | ||
924 | {\tt | ghostview -}. | ||
925 | |||
926 | The best result (best sized figures) is obtained when printing two | ||
927 | pictures on a single page. | ||
928 | |||
929 | |||
930 | \subsection{Including a Postscript File in \LaTeX} | ||
931 | |||
932 | The \verb|Blatexpr| Unix shell and the programs \verb+Batexpr2+ and | ||
933 | \verb+Blatexprs+ are provided in order to help inserting Scilab graphics | ||
934 | in \LaTeX . | ||
935 | |||
936 | Taking the previous file {\tt foo.ps} and typing the following statement | ||
937 | under a Unix shell~: | ||
938 | \begin{verbatim} | 145 | \begin{verbatim} |
939 | Blatexpr 1.0 1.0 foo.ps | 146 | -->l=a.title |
940 | \end{verbatim} | 147 | \end{verbatim} |
941 | creates two files \verb+foo.epsf+ and \verb+foo.tex+. The original | 148 | we see that {\tt l} is itself a handle with a field named ``text''. |
942 | Postscript file is left unchanged. | 149 | We can give a title to the plot by the command \verb!l.text=My plot'! |
943 | To include the figure in a \LaTeX~ document you should insert the following | 150 | Of course it is possible to obtain the same result by |
944 | \LaTeX~ code in your \LaTeX~ document~: | 151 | the command |
945 | |||
946 | \begin{verbatim} | 152 | \begin{verbatim} |
947 | \input foo.tex | 153 | f.children.title.text='My plot' |
948 | \dessin{The caption of your picture}{The-label} | ||
949 | \end{verbatim} | 154 | \end{verbatim} |
155 | This simple example illustrates how to manipulate graphics within Scilab. | ||
950 | 156 | ||
951 | You can also see your figure by using the Postscript | 157 | \section{Graphic objects properties} |
952 | previewer \verb+ghostview+. | 158 | Help on the graphics objects can obtained by the command |
953 | |||
954 | The program \verb+Blatexprs+ does the same thing: it is used to insert | ||
955 | a set of Postscript figures in one \LaTeX picture. | ||
956 | |||
957 | In the following example, we begin by using the Postscript driver {\tt Pos} | ||
958 | and then initialize successively 4 Postscript files | ||
959 | {\tt fig1.ps, ..., fig4.ps} for | ||
960 | 4 different plots and at the end return to the driver {\tt Rec} (X11 driver | ||
961 | with record). | ||
962 | |||
963 | \input{diary/mulplot.dia} | ||
964 | |||
965 | Then we execute the command : | ||
966 | |||
967 | \begin{verbatim} | 159 | \begin{verbatim} |
968 | Blatexprs multi fig1.ps fig2.ps fig3.ps fig4.ps | 160 | -->help graphics_entities |
969 | \end{verbatim} | 161 | \end{verbatim} |
970 | 162 | The properties of the various graphic objects are obtained by the command | |
971 | \noindent and we get 2 files {\tt multi.tex} and {\tt multi.ps} and you can | ||
972 | include the result in a \LaTeX~ source file by : | ||
973 | |||
974 | \begin{verbatim} | 163 | \begin{verbatim} |
975 | \input multi.tex | 164 | -->help object_properties |
976 | \dessin{The caption of your picture}{The-label} | ||
977 | \end{verbatim} | 165 | \end{verbatim} |
166 | where {\verb!object_properties!} is in the following table. | ||
167 | \begin{center} | ||
168 | \begin{tabular}{|c|} | ||
169 | \hline | ||
170 | {\verb!agregation_properties!} \\ \hline | ||
171 | {\verb!arc_properties!} \\ \hline | ||
172 | {\verb!axes_properties!} \\ \hline | ||
173 | {\verb!axis_properties! } \\ \hline | ||
174 | {\verb!champ_properties! } \\ \hline | ||
175 | {\verb!fec_properties!} \\ | ||
176 | {\verb!figure_properties!} \\ \hline | ||
177 | {\verb!grayplot_properties!} \\ \hline | ||
178 | {\verb!label_properties! } \\ \hline | ||
179 | {\verb!legend_properties! } \\ \hline | ||
180 | {\verb!param3d_properties !} \\ \hline | ||
181 | {\verb!polyline_properties! } \\ \hline | ||
182 | {\verb!rectangle_properties !} \\ \hline | ||
183 | {\verb!segs_properties! } \\ \hline | ||
184 | {\verb!text_properties! } \\ \hline | ||
185 | {\verb!title_properties! } \\ \hline | ||
186 | \end{tabular} | ||
187 | \end{center} | ||
188 | |||
189 | To get a handle associated with a graphic object, one can use the | ||
190 | functions {\tt gcf()} (current Figure), {\tt gca()} (current Axes), | ||
191 | or {\tt gce()} (current Entity). From the top figure handle, one | ||
192 | can access the complete tree of (sub)handles by selecting the various | ||
193 | children and parents of a given handle. | ||
194 | |||
195 | \section{Some useful plotting functions} | ||
196 | \subsection{2D plots} | ||
197 | \begin{center} | ||
198 | \begin{tabular}{|c|c|} | ||
199 | \hline | ||
200 | {\tt plot2d } & basic plot function \\ \hline | ||
201 | {\tt plot3d } & plot surface \\ \hline | ||
202 | {\tt param3d } & parametric plot \\ \hline | ||
203 | {\tt (f)champ} & vector field plot \\ \hline | ||
204 | {\tt contour}, {\tt fcontour}, {\tt (f)contour2d}, \\ | ||
205 | {\tt contourf}, {\tt fcontour2d} & level curve plot \\ \hline | ||
206 | {\tt errbar } & add error bar \\ \hline | ||
207 | {\tt Matplot } & 2D plot of a matrix using colors \\ \hline | ||
208 | {\tt histplot} & histogram \\ \hline | ||
209 | {\tt errbar} & vertical bars \\ \hline | ||
210 | {\tt S(f)grayplot} & smooth 2D plot of surface \\ \hline | ||
211 | {\tt (f)grayplot} & 2D plot of surface \\ \hline | ||
212 | \end{tabular} | ||
213 | \end{center} | ||
214 | |||
215 | \subsection{3D plots} | ||
216 | \begin{center} | ||
217 | \begin{tabular}{|c|c|} | ||
218 | \hline | ||
219 | {\tt (f)plot3d } & plot surface \\ \hline | ||
220 | {\tt param3d(1) } & parametric plot \\ \hline | ||
221 | {\tt contour} & level curve plot \\ \hline | ||
222 | {\tt hist3d} & 3D histogram\\ \hline | ||
223 | {\tt genfac3d, eval3dp } & compute factes \\ \hline | ||
224 | {\tt hist3d} & histogram \\ \hline | ||
225 | {\tt geom3d} & 3D projection \\ \hline | ||
226 | {\tt S(f)grayplot} & smooth 2D plot of surface \\ \hline | ||
227 | {\tt (f)grayplot} & 2D plot of surface \\ \hline | ||
228 | \end{tabular} | ||
229 | \end{center} | ||
230 | |||
231 | \subsection{Low level 2D plots} | ||
232 | \begin{center} | ||
233 | \begin{tabular}{|c|c|} | ||
234 | \hline | ||
235 | {\tt xpoly} & polyline plot \\ \hline | ||
236 | {\tt xpolys } & multi-polyline plot \\ \hline | ||
237 | {\tt xrpoly} & regular polygon plot \\ \hline | ||
238 | {\tt xsegs} & draw unconnected segments\\ \hline | ||
239 | {\tt xfpoly(s) } & filled polygon(s) \\ \hline | ||
240 | {\tt xrect } & rectangle plot \\ \hline | ||
241 | {\tt xfrect } & filled rectangle plot \\ \hline | ||
242 | {\tt xrects } & draw or fill rectangles \\ \hline | ||
243 | \end{tabular} | ||
244 | \end{center} | ||
245 | |||
246 | \subsection{Strings, ...} | ||
247 | \begin{center} | ||
248 | \begin{tabular}{|c|c|} | ||
249 | \hline | ||
250 | {\tt xstring, xstringl, xstringb} & string plots \\ \hline | ||
251 | {\tt xarrows} & arrows plot \\ \hline | ||
252 | {\tt xarc(s), xfarc, xfarcs} & arcs plot \\ \hline | ||
253 | \end{tabular} | ||
254 | \end{center} | ||
255 | |||
256 | \subsection{Colors} | ||
257 | \begin{center} | ||
258 | \begin{tabular}{|c|c|} | ||
259 | \hline | ||
260 | {\tt colormap} & set colormap \\ \hline | ||
261 | {\tt getcolor} & select color \\ \hline | ||
262 | {\tt addcolor} & add color to colormap \\ \hline | ||
263 | {\tt graycolormap} & gray colormap \\ \hline | ||
264 | {\tt hotcolormap} & red to yellow colormap \\ \hline | ||
265 | \end{tabular} | ||
266 | \end{center} | ||
267 | |||
268 | \subsection{Mouse position} | ||
269 | \begin{center} | ||
270 | \begin{tabular}{|c|c|} | ||
271 | \hline | ||
272 | {\tt xclick} & wait for a mouse click \\ \hline | ||
273 | {\tt locate } & mouse selection of a set of points \\ \hline | ||
274 | {\tt xgetmouse} & add color to colormap \\ \hline | ||
275 | {\tt graycolormap} & get the current position of the mouse\\ \hline | ||
276 | \end{tabular} | ||
277 | \end{center} | ||
978 | 278 | ||
979 | Note that the second line {\tt dessin...} is absolutely necessary and you | 279 | \section{Animated plot}\label{Animation} |
980 | have of course to give the absolute path for the input file if you are | 280 | \index{animated plot} |
981 | working in another directory (see below). The file {\tt multi.tex} is only | 281 | \subsection{pixmap mode} |
982 | the definition of the command {\tt dessin} with 2 parameters : the caption | 282 | To run the pixmap mode, get the handle of the current figure |
983 | and the label; the command {\tt dessin} can be used with one or two | 283 | \verb!f=gcf();! and activate the pixmap mode \verb!f.pixmap='on'!. |
984 | empty arguments {\tt `` ``} if you want to avoid the caption or the label. | ||
985 | 284 | ||
986 | The Postscipt files are inserted in \LaTeX~ with the help of the | 285 | When the pixmap mode is on, the pixels of the graphic window |
987 | \verb+\special+ command and with a syntax that works with the | 286 | are stored into a temporary buffer which is displayed upon request. |
988 | \verb+dvips+ program. | 287 | The various steps corresponding to the creation of the image are not |
288 | displayed. | ||
989 | 289 | ||
990 | The program \verb+Blatexpr2+ is used when you want two pictures side | 290 | An animated plot using this mode is generally obtained by a |
991 | by side. | 291 | a for or while loop which produces a new image at each iteration. |
992 | \begin{verbatim} | ||
993 | Blatexpr2 Fileres file1.ps file2.ps | ||
994 | \end{verbatim} | ||
995 | 292 | ||
996 | %\def\exemple{d7-12} | 293 | When the image is ready, the screen display is realized by |
997 | \input{figures/d7-12.tex} | 294 | the \scifun{show\_pixmap()} command. |
998 | \caption{\label{d7-12}Blatexp2 Example} | ||
999 | %\dessin{Blatexpr2 Example}{d7-12} | ||
1000 | \end{figure} | ||
1001 | 295 | ||
1002 | It is sometimes convenient to have a main \LaTeX~ document in a directory | 296 | In the animation mode, it is often necessary to set a frame |
1003 | and to store all the figures in a subdirectory. The proper way to | 297 | with given dimensions in which the animated plotting command will take place. |
1004 | insert a picture file in the main document, when the picture | ||
1005 | is stored in the subdirectory \verb+figures+, is the following~: | ||
1006 | 298 | ||
299 | To fix an appropriate frame with extremal values | ||
300 | \scilab{rect=[xmin,ymin,xmax,ymax]} one can set properties of the axes | ||
301 | (\verb!data_bounds! field obtained by \verb!gca()!) or alternaltively | ||
302 | enter the command | ||
303 | \noindent | ||
1007 | \begin{verbatim} | 304 | \begin{verbatim} |
1008 | \def\Figdir{figures/} % My figures are in the {\tt figures/ } subdirectory. | 305 | plot2d([],[],rect=[xmin,ymin,xmax,ymax]). |
1009 | \input{figures/fig.tex} | ||
1010 | \dessin{The caption of you picture}{The-label} | ||
1011 | \end{verbatim} | 306 | \end{verbatim} |
1012 | 307 | ||
1013 | The declaration \verb+\def\Figdir{figures/}+ is used twice, first to | 308 | Assume that \scilab{y=phi(x,t)} is a vector with the same |
1014 | find the file {\tt fig.tex} (when you use \verb+latex+), and | 309 | dimension as \scilab{x} |
1015 | second to produce a correct pathname for the | 310 | and depending on the parameter \scilab{t}. The animated graph of \scilab{y} |
1016 | \verb+special+ \LaTeX~ command found in \verb+fig.tex+. (used at | 311 | as a function of \scilab{t} (for a fixed \scilab{x} vector), is seen by |
1017 | dvips level). | 312 | the following code~: |
1018 | |||
1019 | -WARNING : the default driver is {\tt Rec}, i.e. all the graphic commands are | ||
1020 | recorded, one record corresponding to one window. The {\tt xbasc()} command | ||
1021 | erases the plot on the active window and all the records corresponding to | ||
1022 | this window. The {\tt clear} button has the same effect; the {\tt xclear} | ||
1023 | command erases the plot but the record is preserved. So you almost never need | ||
1024 | to use the {\tt xbasc()} or {\tt clear} commands. If you use such a command | ||
1025 | and if you re-do a plot you may have a surprising result (if you forget | ||
1026 | that the environment is wiped out); the scale only is preserved and so you | ||
1027 | may have the ``window-plot'' and the ``paper-plot'' completely different. | ||
1028 | |||
1029 | |||
1030 | \subsection{Postscript by Using Xfig} | ||
1031 | |||
1032 | Another useful way to get a Postscript file for a plot is to use Xfig. | ||
1033 | By the simple command {\tt xs2fig(active-window-number,file-name)} you get | ||
1034 | a file in Xfig syntax. | ||
1035 | |||
1036 | This command needs the use of the driver {\tt Rec}. | ||
1037 | |||
1038 | The window ScilabGraphic0 being active, if you enter : | ||
1039 | |||
1040 | \begin{verbatim} | 313 | \begin{verbatim} |
1041 | 314 | f.pixmap='on'; //The data is sent into a pixmap | |
1042 | -->t=-%pi:0.3:%pi; | 315 | plot2d(x,phi(x,theta(1))); //First y for t=theta(1) |
1043 | 316 | w=gce(); //The current entity | |
1044 | -->plot3d1(t,t,sin(t)'*cos(t),theta=35,alpha=45,flag=[2,2,4]); | 317 | for t=theta |
1045 | 318 | w.children.data(:,2)=phi(x,t)'; //update y | |
1046 | -->xs2fig(0,'demo.fig'); | 319 | show_pixmap(); //display the pixmap content |
1047 | 320 | end | |
1048 | \end{verbatim} | 321 | \end{verbatim} |
322 | The role of pixmap mode is to avoid image blinking. Any modification | ||
323 | of a graphic property implies a complete display of the new graph | ||
324 | (including axes, titles etc). In the pixmap mode the new image is | ||
325 | built and displayed afterwards by the \scifun{show\_pixmap()} command. | ||
1049 | 326 | ||
1050 | you get the file {\tt demo.fig} which contains the plot | 327 | Function \scifun{xpause} can be used to slow down the graphic display. |
1051 | of window 0. | ||
1052 | |||
1053 | Then you can use Xfig and after the modifications you want, get a Postscript | ||
1054 | file that you can insert in a \LaTeX~ file. The following figure is the result | ||
1055 | of Xfig after adding some comments. | ||
1056 | |||
1057 | \begin{figure} | ||
1058 | %BEGIN IMAGE | ||
1059 | \fbox{\hspace*{0.cm} \begin{picture}(400.0,350.0)(100.0,200.0) | ||
1060 | \hspace{-0.8cm} | ||
1061 | \special{psfile=figures/demo.ps} | ||
1062 | \end{picture}} | ||
1063 | %END IMAGE | ||
1064 | %HEVEA\imageflush | ||
1065 | |||
1066 | \caption{Encapsulated Postscript by Using Xfig} | ||
1067 | \label{xfig2ps} | ||
1068 | \end{figure} | ||
1069 | |||
1070 | |||
1071 | \subsection{Encapsulated Postscript Files} | ||
1072 | As it was said before, the use of {\tt Blatexpr} creates 2 files : a | ||
1073 | {\tt .tex} file to be inserted in the \LaTeX~ file and a {\tt .epsf} file. | ||
1074 | |||
1075 | It is possible to get the encapsulated Postscript file corresponding to a | ||
1076 | {\tt .ps} file by using the command {\tt BEpsf}. | ||
1077 | 328 | ||
1078 | Notice that the {\tt .epsf} file generated by {\tt Blatexpr} is not an | 329 | %\end{center} |
1079 | encapsulated Postscript file : it has no bounding box and {\tt BEpsf} | ||
1080 | generates a {\tt .eps} file which is an encapsulated Postscript file with | ||
1081 | a bounding box. | ||
diff --git a/scilab_doc/intro/intro.tex b/scilab_doc/intro/intro.tex index fb6ae9d..0fd05c7 100755 --- a/scilab_doc/intro/intro.tex +++ b/scilab_doc/intro/intro.tex | |||
@@ -1,25 +1,28 @@ | |||
1 | % Copyright INRIA | ||
2 | |||
3 | \documentclass[11pt]{report} | 1 | \documentclass[11pt]{report} |
4 | 2 | ||
5 | \usepackage{makeidx} | 3 | \usepackage{scilab} |
6 | \textheight=660pt | ||
7 | \textwidth=15cm | ||
8 | \topmargin=-27pt | ||
9 | \oddsidemargin=0.7cm | ||
10 | \evensidemargin=0.7cm | ||
11 | \marginparwidth=60pt | ||
12 | 4 | ||
5 | \usepackage{amsmath,amssymb,times,subfigure,epsfig,fancyheadings,verbatim,moreverb,makeidx} | ||
6 | \usepackage{hyperref} | ||
7 | \usepackage[T1]{fontenc} | ||
13 | \def\Figdir{figures/} | 8 | \def\Figdir{figures/} |
14 | 9 | ||
15 | \makeindex | 10 | \makeindex |
11 | \textheight=21cm | ||
12 | % \textwidth=15cm | ||
13 | \textwidth=15cm | ||
14 | % \topmargin=-27pt | ||
15 | \oddsidemargin=0.7cm | ||
16 | \evensidemargin=0.7cm | ||
17 | % \marginparwidth=60pt | ||
18 | |||
16 | 19 | ||
17 | \begin{document} | 20 | \begin{document} |
18 | 21 | ||
19 | \include{chap0} | 22 | \include{chap0} |
20 | 23 | ||
21 | \pagenumbering{roman} | 24 | \pagenumbering{roman} |
22 | \tableofcontents | 25 | %\tableofcontents |
23 | \pagestyle{headings} | 26 | \pagestyle{headings} |
24 | \pagenumbering{arabic} | 27 | \pagenumbering{arabic} |
25 | 28 | ||
@@ -35,8 +38,6 @@ | |||
35 | 38 | ||
36 | \include{chap6} %interfacing | 39 | \include{chap6} %interfacing |
37 | 40 | ||
38 | %\include{appendices} | ||
39 | |||
40 | \listoffigures | 41 | \listoffigures |
41 | 42 | ||
42 | \printindex | 43 | \printindex |