summaryrefslogtreecommitdiffstats
path: root/scilab_doc
diff options
context:
space:
mode:
authorFrancois Delebecque <Francois.Delebecque@inria.fr>2004-09-23 14:31:36 +0000
committerFrancois Delebecque <Francois.Delebecque@inria.fr>2004-09-23 14:31:36 +0000
commitf6dd92e366bba70a1712e90d272086c61f3676fe (patch)
treeadafb377e86f917fb289a2bbc7d2d2c73dfac17c /scilab_doc
parent5fbd13c8520a5dc9fc42f83d4d250036c5d4474f (diff)
downloadscilab-f6dd92e366bba70a1712e90d272086c61f3676fe.zip
scilab-f6dd92e366bba70a1712e90d272086c61f3676fe.tar.gz
new
Diffstat (limited to 'scilab_doc')
-rwxr-xr-xscilab_doc/intro/Makefile2
-rwxr-xr-xscilab_doc/intro/appendices.tex574
-rwxr-xr-xscilab_doc/intro/chap0.tex28
3 files changed, 337 insertions, 267 deletions
diff --git a/scilab_doc/intro/Makefile b/scilab_doc/intro/Makefile
index e9bedef..3bf7a03 100755
--- a/scilab_doc/intro/Makefile
+++ b/scilab_doc/intro/Makefile
@@ -31,7 +31,7 @@ distclean::
31 intro_pdf.* *.tmp Intro_pdf.ps *.hind *.haux *.html intro-html*.gif\ 31 intro_pdf.* *.tmp Intro_pdf.ps *.hind *.haux *.html intro-html*.gif\
32 intro-html.image.tex *_motif.gif 32 intro-html.image.tex *_motif.gif
33 33
34SUBDIRS = diary figures fort macros 34SUBDIRS = diary figures macros
35 35
36subs: 36subs:
37 @case '${MFLAGS}' in *[ik]*) set +e;; esac; \ 37 @case '${MFLAGS}' in *[ik]*) set +e;; esac; \
diff --git a/scilab_doc/intro/appendices.tex b/scilab_doc/intro/appendices.tex
index c6039a2..db827bd 100755
--- a/scilab_doc/intro/appendices.tex
+++ b/scilab_doc/intro/appendices.tex
@@ -1,286 +1,354 @@
1% Copyright INRIA 1% Copyright INRIA
2 2
3\appendix 3\appendix
4\chapter{Demo session} 4
5We give here the Scilab session corresponding to the first demo. 5\chapter{Linear system representation}
6 6Linear systems are treated as specific typed lists {\tt tlist}.
7\input{diary/demo1.dia} 7The basic function which is used for defining linear systems is {\tt syslin}.
8 8This function receives as parameters the constant matrices which
9\chapter{System interconnexion} 9define a linear system in state-space form or, in the case of
10 10system in transfer form, its input must be a rational matrix.
11%\section{System Interconnection} 11To be more specific, the calling sequence of {\tt syslin} is
12 The purpose of this appendix is to illustrate some 12either {\tt Sl=syslin('dom',A,B,C,D,x0)} or {\tt Sl=syslin('dom',trmat)}.
13of the more sophisticated aspects of Scilab by the way of an example. 13{\tt dom} is one of the character strings {\tt 'c'} or {\tt 'd'}
14The example shows how Scilab can be used to symbolically represent 14for continuous time or discrete time systems respectively.
15the inter-connection of multiple systems which in turn can 15It is useful to note that {\tt D} can be a polynomial matrix
16then be used to numerically evaluate the performance of the 16(improper systems); {\tt D} and {\tt x0} are optional arguments.
17inter-connected systems. The symbolic representation of the 17{\tt trmat} is a rational matrix i.e. it is defined as a matrix
18inter-connected systems is done with a function called {\tt bloc2exp} 18of rationals (ratios of polynomials). {\tt syslin} just converts
19\index{bloc2exp@{\tt bloc2exp}} 19its arguments (e.g. the four matrices A,B,C,D) into a typed
20and the evaluation of the resulting system is done with 20list {\tt Sl}. For state space representation {\tt Sl} is
21{\tt evstr}\index{evstr@{\tt evstr}}. 21the {\tt tlist(['lss','A','B','C','D'],A,B,C,D,'dom')}. This tlist
22 22representation allows to access the A-matrix i.e. the second entry of
23 The example illustrates the symbolic inter-connection of the 23{\tt Sl} by the syntax {\tt Sl('A')} (equivalent to {\tt Sl(2)}).
24systems shown in Figure~\ref{fa.1}\index{linear systems!inter-connection of}. 24Conversion from a representation to another is done by {\tt ss2tf}
25or {\tt tf2ss}. Improper systems are also treated. {\tt syslin}
26defines linear systems as specific {\tt tlist}. ({\tt help syslin}).
27
28\input{diary/syslin.dia}
29
30 The list representation allows manipulating linear systems as
31abstract data objects. For example, the linear system can be combined
32with other linear systems or the transfer function representation of
33the linear system can be obtained as was done above using {\tt ss2tf}.
34Note that the transfer function representation of the linear system
35is itself a tlist.
36 A very useful aspect of the manipulation of systems
37is that a system can be handled as a data object.
38Linear systems can be
39inter-connected\index{linear systems!inter-connection of},
40their representation
41can easily be changed from state-space to transfer function
42and vice versa.
43
44 The inter-connection of linear systems can be made
45as illustrated in Figure~\ref{f3.2}.
25% 46%
26\begin{figure} 47\begin{figure}
48
49%BEGIN IMAGE
27\begin{center} 50\begin{center}
28\begin{picture}(360,204) 51\begin{picture}(200,330)(0,-60)
29 52
30\put(80,85){\framebox(40,30){\tt Model}} 53\put(180,280){\makebox(0,0)[lb]{\tt S2*S1}}
31\put(150,85){\framebox(40,30){\tt Reg}} 54\put(9,280){\circle{2}}
32\put(240,85){\framebox(40,30){\tt Proc}} 55\put(10,280){\vector(1,0){20}}
33\put(120,140){\framebox(40,30){\tt FF}} 56\put(30,270){\framebox(30,20){$S_1$}}
34\put(190,30){\framebox(40,30){\tt Sensor}} 57\put(60,280){\vector(1,0){30}}
35\put(210,100){\framebox(0,0){\tt +}} 58\put(90,270){\framebox(30,20){$S_2$}}
36 59\put(120,280){\vector(1,0){20}}
37\put(35,95){\tt U} 60\put(141,280){\circle{2}}
38\put(315,95){\tt Y} 61
39\put(315,125){\tt UP} 62\put(180,220){\makebox(0,0)[lb]{\tt S1+S2}}
40 63\put(29,220){\circle{2}}
41\put(50,100){\vector(1,0){30}} 64\put(30,220){\line(1,0){20}}
42\put(120,100){\vector(1,0){30}} 65\put(50,220){\circle*{2}}
43\put(190,100){\vector(1,0){15}} 66\put(50,200){\line(0,1){40}}
44\put(215,100){\vector(1,0){25}} 67\put(50,200){\vector(1,0){20}}
45\put(210,155){\vector(0,-1){50}} 68\put(50,240){\vector(1,0){20}}
46\put(295,45){\vector(-1,0){65}} 69\put(70,190){\framebox(30,20){$S_2$}}
47\put(65,155){\vector(1,0){55}} 70\put(70,230){\framebox(30,20){$S_1$}}
48\put(170,45){\vector(0,1){40}} 71\put(100,200){\line(1,0){20}}
49\put(225,130){\vector(1,0){85}} 72\put(100,240){\line(1,0){20}}
50\put(280,100){\vector(1,0){30}} 73\put(120,240){\vector(0,-1){15}}
51 74\put(120,200){\vector(0,1){15}}
52\put(65,100){\line(0,1){55}} 75\put(120,220){\circle{10}}
53\put(160,155){\line(1,0){50}} 76\put(120,220){\framebox(0,0){$+$}}
54\put(170,45){\line(1,0){20}} 77\put(125,220){\vector(1,0){15}}
55\put(225,100){\line(0,1){30}} 78\put(141,220){\circle{2}}
56\put(295,100){\line(0,-1){55}} 79
57 80\put(180,140){\makebox(0,0)[lb]{\tt [S1,S2]}}
58\put(210,100){\circle{10}} 81\put(49,160){\circle{2}}
59\put(48,100){\circle{2}} 82\put(49,120){\circle{2}}
60\put(310,100){\circle{2}} 83\put(50,120){\vector(1,0){20}}
61\put(310,130){\circle{2}} 84\put(50,160){\vector(1,0){20}}
62\put(65,100){\circle*{2}} 85\put(70,110){\framebox(30,20){$S_2$}}
63\put(225,100){\circle*{2}} 86\put(70,150){\framebox(30,20){$S_1$}}
64\put(295,100){\circle*{2}} 87\put(100,120){\line(1,0){20}}
88\put(100,160){\line(1,0){20}}
89\put(120,160){\vector(0,-1){15}}
90\put(120,120){\vector(0,1){15}}
91\put(120,140){\circle{10}}
92\put(120,140){\framebox(0,0){$+$}}
93\put(125,140){\vector(1,0){15}}
94\put(141,140){\circle{2}}
65 95
96\put(180,50){\makebox(0,0)[lb]{\tt [S1 ; S2]}}
97\put(49,50){\circle{2}}
98\put(50,50){\line(1,0){20}}
99\put(70,50){\circle*{2}}
100\put(70,30){\line(0,1){40}}
101\put(70,30){\vector(1,0){20}}
102\put(70,70){\vector(1,0){20}}
103\put(90,20){\framebox(30,20){$S_2$}}
104\put(90,60){\framebox(30,20){$S_1$}}
105\put(120,30){\vector(1,0){20}}
106\put(120,70){\vector(1,0){20}}
107\put(141,30){\circle{2}}
108\put(141,70){\circle{2}}
109
110\put(180,-40){\makebox(0,0)[lb]{\tt S1/.S2}}
111\put(70,-20){\circle{10}}
112\put(70,-20){\framebox(0,0){$+$}}
113\put(34,-20){\vector(1,0){30}}
114\put(33,-20){\circle{2}}
115\put(70,-60){\line(0,1){40}}
116\put(70,-60){\line(1,0){20}}
117\put(70,-20){\vector(1,0){20}}
118\put(90,-70){\framebox(30,20){$S_2$}}
119\put(90,-30){\framebox(30,20){$S_1$}}
120\put(140,-60){\vector(-1,0){20}}
121\put(120,-20){\line(1,0){20}}
122\put(141,-20){\circle{2}}
123\put(140,-60){\line(0,1){40}}
66\end{picture} 124\end{picture}
67\end{center} 125\end{center}
68\caption{Inter-Connected Systems} 126%END IMAGE
69\label{fa.1} 127%HEVEA\imageflush
128
129\caption{Inter-Connection of Linear Systems}
130\label{f3.2}
70\end{figure} 131\end{figure}
71% 132%
72Figure~\ref{fa.1} illustrates the classic regulator problem\index{regulator} 133For each of the possible inter-connections of two systems
73where the block labeled {\tt Proc} is to be controlled 134{\tt S1} and {\tt S2} the command which makes the inter-connection
74using feedback from the {\tt Sensor} block and {\tt Reg} block. 135is shown on the right side of the corresponding block diagram in
75The {\tt Reg} block compares the output from the {\tt Model} 136Figure~\ref{f3.2}. Note that feedback interconnection is performed by
76block to the output from the {\tt Sensor} block to decide how to 137\verb!S1/.S2!.
77regulate the {\tt Proc} block. There is also a feed-forward 138
78block which filters the input signal {\tt U} to the {\tt Proc} 139 The representation of linear systems can be in state-space
79block. The outputs of the system are {\tt Y} and {\tt UP}. 140form or in transfer function form. These two representations can
80 141be interchanged by using the functions
81 The system illustrated in Figure~\ref{fa.1} can 142{\tt tf2ss}\index{linear systems!{\tt tf2ss}}\index{tf2ss@{\tt tf2ss}} and
82be represented in Scilab by using the function {\tt bloc2exp}. 143{\tt ss2tf}\index{linear systems!{\tt ss2tf}}\index{ss2tf@{\tt ss2tf}}
83The use of {\tt bloc2exp} is illustrated in the following Scilab 144which change the representations of systems from transfer function
84session. 145to state-space and from state-space to transfer function, respectively.
85There a two kinds of objects: ``transfer'' and ``links''. The example 146An example of the creation, the change in representation, and the
86considered here admits 5 transfers and 7 links. 147inter-connection of linear systems is demonstrated in the following
87First the transfer are defined in a symbolic manner. Then links 148Scilab session.
88are defined and an ``interconnected system'' is defined as 149
89a specific list. The function {\tt bloc2exp} evaluates symbolically 150\input{diary/connect.dia}
90the global transfer and {\tt evstr} evaluates numerically 151
91the global transfer function once the systems are given ``values'', i.e. 152The above session is a bit long but illustrates some very important
92are defined as Scilab linear systems. 153aspects of the handling of linear systems. First, two linear systems
93% 154are created in transfer function form using the function called
155{\tt syslin}\index{linear systems!{\tt syslin}}\index{syslin@{\tt syslin}}.
156This function was used to label the systems in this example
157as being continuous (as opposed to discrete).
158The primitive {\tt tf2ss} is used to convert one of the
159two transfer functions to its equivalent state-space representation
160which is in list form (note that the function {\tt ssprint} creates a more
161readable format for the state-space linear system).
162The following multiplication of the two systems yields their
163series inter-connection. Notice that the inter-connection
164of the two systems is effected even though one of the systems is
165in state-space form and the other is in transfer function form.
166The resulting inter-connection is given in state-space form.
167Finally, the function {\tt ss2tf} is used to convert the resulting
168inter-connected systems to the equivalent transfer function representation.
169
170
171\chapter{A Maple to Scilab Interface}
172To combine symbolic computation of the computer algebra system Maple with the
173numerical facilities
174of Scilab, Maple objects can be transformed into Scilab functions. To assure
175efficient numerical evaluation this is done through numerical evaluation in
176Fortran. The whole process is done by a Maple procedure called
177\verb/maple2scilab/.
178\section{Maple2scilab}
179\index{maple2scilab@{\tt maple2scilab}}
180The procedure \verb!maple2scilab! converts a Maple object,
181either a scalar function or a matrix into a Fortran subroutine
182and writes the associated Scilab function. The code of \verb!maple2scilab!
183is in the directory \verb!SCIDIR/maple!.
184
185The calling sequence of \verb!maple2scilab! is as follows:\\
186\verb!maple2scilab(function-name,object,args)!
187\begin{itemize}
188\item
189The first argument, \verb!function-name! is a name indicating the
190function-name in Scilab.
191\item
192The second argument \verb!object! is the Maple name of the expression
193to be transferred to Scilab.
194\item
195The third argument is a list of arguments containing the formal parameters of
196the Maple-object \verb!object!.
197\end{itemize}
198When \verb!maple2scilab! is invoked in Maple, two files are generated,
199one which contains the Fortran code and another which contains the
200associated Scilab function. Aside their existence, the user has not to
201know about their contents.
202
203The Fortran routine which is generated has the following calling sequence:\\
204{\tt <Scilab-name>(x1,x2,\ldots,xn,matrix)} \\
205and this subroutine computes matrix(i,j) as a function of
206the arguments {\tt x1,x2,\ldots,xn}.
207Each argument can be a Maple scalar or array which should be
208in the argument list.
209The Fortran subroutine is put into a file named {\tt <Scilab-name>.f}, the
210Scilab-function into a file named {\tt <Scilab-name>.sci}.
211For numerical evaluation in Scilab the user has to compile the Fortran
212subroutine, to link it with Scilab (e.g. Menu-bar option '\verb!link!')
213and to load the associated function (Menu-bar option '\verb!getf!').
214Information about \verb!link! operation is given in Scilab's manual:
215Fortran routines can be incorporated into Scilab by dynamic
216link or through the \verb!Ex-fort.f! file in the \verb!default! directory.
217 Of course, this two-step procedure can be automatized using a shell-script
218(or using \verb!unix! in Scilab).
219Maple2scilab uses the ``Macrofort'' library which is in the share
220library of Maple.
221\subsection{Simple Scalar Example}
222\paragraph{Maple-Session}
94\begin{verbatim} 223\begin{verbatim}
224> read(`maple2scilab.maple`):
225> f:=b+a*sin(x);
226
227 f := b + a sin(x)
228
229> maple2scilab('f_m',f,[x,a,b]);
230\end{verbatim}
231Here the Maple variable \verb!f! is a scalar expression but it could be also
232a Maple vector or matrix.
233\verb/ 'f_m'/ will be the name of \verb!f! in Scilab
234(note that the Scilab name is restricted to contain at most 6 characters).
235The procedure \verb/maple2scilab/ creates two files: \verb/f_m.f/
236and \verb/f_m.sci/ in the directory where Maple is started.
237To specify another directory just define in Maple the path :
238\verb/rpath:=`//\verb/work//` ; then all files are written in
239the sub-directory \verb/work/.
240The file \verb!f_m.f! contains the source code of a stand alone Fortran
241routine which is dynamically linked to Scilab by the function \verb!f_m! in
242defined in the file \verb!f_m.sci!.
243
244\paragraph{Scilab Session}
245\begin{verbatim}
246-->unix('make f_m.o');
95 247
96-->model=2;reg=3;proc=4;sensor=5;ff=6;somm=7; 248-->link('f_m.o','f_m');
97 249
98-->tm=list('transfer','model');tr=list('transfer',['reg(:,1)','reg(:,2)']); 250linking _f_m_ defined in f_m.o
99
100-->tp=list('transfer','proc');ts=list('transfer','s
101ensor');
102
103-->tf=list('transfer','ff');tsum=list('transfer',['1','1']);
104
105-->lum=list('link','input',[-1],[model,1],[ff,1]);
106
107-->lmr=list('link','model output',[model,1],[reg,1]);
108
109-->lrs=list('link','regulator output',[reg,1],[somm,1]);
110
111-->lfs=list('link','feed-forward output',[ff,1],[somm,2]);
112
113-->lsp=list('link','proc input',[somm,1],[proc,1],[-2]);
114
115-->lpy=list('link','proc output',[proc,1],[sensor,1],[-1]);
116
117-->lsup=list('link','sensor output',[sensor,1],[reg,2]);
118
119-->syst=...
120 list('blocd',tm,tr,tp,ts,tf,tsum,lum,lmr,lrs,lfs,lsp,lpy,lsup);
121
122-->[sysf,names]=bloc2exp(syst)
123 names =
124
125
126 names>1
127
128 input
129 251
130 names>2 252-->getf('f_m.sci','c')
131 253
132!proc output ! 254-->f_m(%pi,1,2)
133! ! 255 ans =
134!proc input !
135 sysf =
136 256
137!proc*((eye()-reg(:,2)*sensor*proc)\(-(-ff-reg(:,1)*model))) ! 257 2.
138! !
139!(eye()-reg(:,2)*sensor*proc)\(-(-ff-reg(:,1)*model)) !
140\end{verbatim} 258\end{verbatim}
141% 259
142Note that the argument to {\tt bloc2exp} is a list of lists. The 260\subsection{Matrix Example}
143first element of the list {\tt syst} is (actually) the character string 261This is an example of transferring a Maple matrix into Scilab.
144{\tt 'blocd'} which indicates that the list represents a block-diagram 262\paragraph{Maple Session}
145inter-connection of systems. Each list entry in the list {\tt syst}
146represents a block or an inter-connection in Figure~\ref{fa.1}.
147The form of a list which represents a block begins with a character
148string {\tt 'transfer'} followed by a matrix of character strings
149which gives the symbolic name of the block. If the block is multi-input
150multi-output the matrix of character strings must be represented as
151is illustrated by the block {\tt Reg}.
152
153 The inter-connections between blocks is also represented by lists.
154The first element of the list is the character string {\tt 'link'}.
155The second element of the inter-connection is its symbolic name.
156The third element of the inter-connection is the input to the connection.
157The remaining elements are all the outputs of the connection.
158Each input and output to an inter-connection is a vector which
159contains as its first element the block number (for instance the {\tt model}
160block is assigned the number $2$). The second element of the vector
161is the port number for the block (for the case of multi-input multi-output
162blocks). If an inter-connection is not attached to anything the value
163of the block number is negative (as for example the inter-connection
164labeled {\tt 'input'} or is omitted.
165
166 The result of the {\tt bloc2exp} function is a list of names
167which give the unassigned inputs and outputs of the system and
168the symbolic transfer function of the system given by {\tt sysf}.
169The symbolic names in {\tt sysf} can be associated to polynomials
170and evaluated using the function {\tt evstr}. This is illustrated in the
171following Scilab session.
172%
173\begin{verbatim} 263\begin{verbatim}
174 264> with(linalg):read(`maple2scilab.maple`):
175-->s=poly(0,'s');ff=1;sensor=1;model=1;proc=s/(s^2+3*s+2); 265
176 266> x:=vector(2):par:=vector(2):
177-->reg=[1/s 1/s];sys=evstr(sysf) 267
178 sys = 268> mat:=matrix(2,2,[x[1]^2+par[1],x[1]*x[2],par[2],x[2]]);
179 269
180! 1 + s ! 270 [ 2 ]
181! ---------- ! 271 [ x[1] + par[1] x[1] x[2] ]
182! 2 ! 272 mat := [ ]
183! 1 + 3s + s ! 273 [ par[2] x[2] ]
184! ! 274
185! 2 3 ! 275> maple2scilab('mat',mat,[x,par]);
186! 2 + 5s + 4s + s !
187! ---------------- !
188! 2 3 !
189! s + 3s + s !
190 276
191\end{verbatim} 277\end{verbatim}
192% 278
193The resulting polynomial transfer function links the input 279\paragraph{Scilab Session}
194of the block system to the two outputs. Note that the output
195of {\tt evstr} is the rational polynomial matrix {\tt sys}
196whereas the output of {\tt bloc2exp} is a matrix of character strings.
197
198The symbolic evaluation which is given here is not very efficient
199with large interconnected systems. The function {\tt bloc2ss}
200performs the previous calculation in state-space format.
201Each system is given now in state-space
202as a {\tt syslin} list or simply as a gain (constant matrix).
203Note {\tt bloc2ss} performs the necessary conversions if this
204is not done by the user. Each system must be given a value before
205bloc2ss is called. All the calculations are made in state-space
206representation even if the linear systems are given in transfer form.
207
208\chapter{Converting Scilab functions to Fortran}
209
210\section{Converting Scilab Functions to Fortran Routines}
211
212Scilab provides a compiler (under development) to transform some Scilab
213functions
214into Fortran subroutines. The routines which are thus obtained
215make use of the routines which are in the Fortran libraries.
216All the basic matrix operations are available.
217
218Let us consider the following Scilab function:
219\begin{verbatim} 280\begin{verbatim}
281-->unix('make mat.o');
282
283-->link('mat.o','mat')
220 284
221function [x]=macr(a,b,n) 285linking _mat_ defined in mat.o
222z=n+m+n, 286
223c(1,1)=z, 287-->getf('mat.sci','c')
224c(2,1)=z+1,
225c(1,2)=2,
226c(2,2)=0,
227if n=1 then,
228 x=a+b+a,
229else,
230x=a+b-a'+b,
231end,
232y=a(3,z+1)-x(z,5),
233x=2*x*x*2.21,
234sel=1:5,
235t=a*b,
236for k=1:n,
237 z1=z*a(k+1,k)+3,
238end,
239t(sel,5)=a(2:4,7),
240x=[a b;-b' a']
241 288
289-->par=[50;60];x=[1;2];
290
291-->mat(x,par)
292 ans =
293
294! 51. 2. !
295! 60. 2. !
296
242\end{verbatim} 297\end{verbatim}
243 298
244which can be translated into Fortran by using the function {\tt mac2for}. 299{\small
245Each input parameter of the subroutine is described by a list 300\paragraph{Generated code}
246which contains its type and its dimensions. Here, we have three 301Below is the code (Fortran subroutines and Scilab functions) which is
247input variables {\tt a,b,c} which are, say, {\tt 302automatically generated by {\tt maple2scilab} in the two preceding examples.
248double precision, double precision, integer} with dimensions 303\paragraph{Fortran routines}
249{\tt (m,m), (m,m), (1,1)}. This information is gathered
250in the following list:
251\begin{verbatim} 304\begin{verbatim}
252l=list(); 305c
253l(1)=list('1','m','m'); 306c SUBROUTINE f_m
254l(2)=list('1','m','m'); 307c
255l(3)=list('0','1','1'); 308 subroutine f_m(x,a,b,fmat)
309 doubleprecision x,a,b
310 implicit doubleprecision (t)
311 doubleprecision fmat(1,1)
312 fmat(1,1) = b+a*sin(x)
313 end
256\end{verbatim} 314\end{verbatim}
257The call to {\tt mac2for} is made as follows:
258\begin{verbatim} 315\begin{verbatim}
259comp(macr); 316c
260mac2for(macr2lst(macr),l) 317c SUBROUTINE mat
318c
319 subroutine mat(x,par,fmat)
320 doubleprecision x,par(2)
321 implicit doubleprecision (t)
322 doubleprecision fmat(2,2)
323 t2 = x(1)**2
324 fmat(2,2) = x(2)
325 fmat(2,1) = par(2)
326 fmat(1,2) = x(1)*x(2)
327 fmat(1,1) = t2+par(1)
328 end
261\end{verbatim} 329\end{verbatim}
262The output of this command is a string containing a stand-alone Fortran 330\paragraph{Scilab functions}
263subroutine.
264\begin{verbatim} 331\begin{verbatim}
265 subroutine macr(a,b,n,x,m,work,iwork) 332function [var]=f_m(x,a,b)
266c! 333var=call('f_m',x,1,'d',a,2,'d',b,3,'d','out',[1,1],4,'d')
267c automatic translation 334\end{verbatim}
268. 335\begin{verbatim}
269. 336function [var]=fmat(x,par)
270. 337var=call('fmat',x,1,'d',par,2,'d','out',[2,2],3,'d')
271 double precision a(m,m),b(m,m),x(m+m,m+m),y,z1,24(m,m),work(*) 338\end{verbatim}
272 integer n,m,z,c(2,2),sel(5),k,iwork(*) 339}
273.
274.
275.
276 call dmcopy(b,m,x(1,m+1),m+m,m,m)
277 call dmcopy(work(iw1),m,x(m+1,1),m+m,m,m)
278 call dmcopy(work(iw1),m,x(m+1,m+1),m+m,m,m)
279 return
280c
281 end
282 340
341\subsection{The {\tt addinter} command}
342Once the interface program is written, it must be compiled to produce
343an object file. It is then linked to Scilab by the addinter command.
344
345The syntax of addinter is the following:
346
347{\tt addinter([`interface.o', 'userfiles.o'],'entrypt',['scifcts'])}
348
349Here {\tt interface.o} is the object file of the interface,
350{\tt userfiles.o} is the set of user's routines to be linked,
351{\tt entrypt} is the entry point of the interface routine and
352{'scifcts'} is the set of Scilab functions to be interfaced.
283 353
284\end{verbatim}
285This routine can be linked to Scilab and interactively called.
286 354
diff --git a/scilab_doc/intro/chap0.tex b/scilab_doc/intro/chap0.tex
index 139e31b..0e9182d 100755
--- a/scilab_doc/intro/chap0.tex
+++ b/scilab_doc/intro/chap0.tex
@@ -3,19 +3,19 @@
3\pagestyle{empty} 3\pagestyle{empty}
4 4
5 5
6\hspace*{-2.cm} 6%\hspace*{-2.cm}
7. 7%.
8%BEGIN IMAGE 8%BEGIN IMAGE
9\fbox{\hspace*{0.cm} \begin{picture}(500.0,680.0) 9%\fbox{\hspace*{0.cm} \begin{picture}(500.0,680.0)
10\vspace{-3.cm} 10%\vspace{-3.cm}
11\special{psfile=intro.couv1} 11%\special{psfile=intro.couv1}
12\hspace*{-2.cm} 12%\hspace*{-2.cm}
13\special{psfile=intro.couv2} 13%\special{psfile=intro.couv2}
14\end{picture}} 14%\end{picture}}
15%END IMAGE 15%END IMAGE
16%HEVEA\imageflush 16%HEVEA\imageflush
17 17
18\newpage 18%\newpage
19\vspace{8.cm} 19\vspace{8.cm}
20 20
21{\Huge\bf {INTRODUCTION}} 21{\Huge\bf {INTRODUCTION}}
@@ -32,22 +32,24 @@
32 32
33\vspace{3.cm} 33\vspace{3.cm}
34 34
35{\Huge\bf {Scilab Group}} 35%{\Huge\bf {Scilab Research Core Team}}
36 36
37{\Large\bf 37{\Large\bf
38INRIA Meta2 Project/ENPC Cergrene} 38INRIA/ENPC}
39 39
40{\normalsize\bf 40{\normalsize\bf
41 41
42\vspace{12.cm} 42\vspace{12.cm}
43 43
44INRIA - Unit\'e de recherche de Rocquencourt - Projet Meta2 44INRIA - Rocquencourt unit - Metalau project.
45 45
46Domaine de Voluceau - Rocquencourt - B.P. 105 - 78153 Le Chesnay Cedex (France) 46Domaine de Voluceau - Rocquencourt - B.P. 105 - 78153 Le Chesnay Cedex (France)
47 47
48ENPC - Cit\'e Descartes -Champs sur Marne- 77455 Marne la Vall\'ee Cedex (France)
49
48E-mail : scilab@inria.fr} 50E-mail : scilab@inria.fr}
49 51
50{\normalsize\bf Home page : http://www-rocq.inria.fr/scilab} 52{\normalsize\bf Home page : \href{http://www.scilab.org}{www.scilab.org}}
51 53
52\newpage 54\newpage
53\mbox{ } 55\mbox{ }