Top Banner
8/8/2019 How to Sci Lab http://slidepdf.com/reader/full/how-to-sci-lab 1/13 1 SCILAB An overview of Scilab’s introduction, how to install, how to use and small demo  program. I. Introduction SCILAB is a free scientific software for engineering and scientific applications. It bases on a numerical, programming and graphics environment; similar in operation but different syntax from MATLAB. This is a self-contained package developed since 1990 by researchers from INRIA and ENPC (France); it is now maintained and developed by Scilab Consortium since its creation in May 2003. Distributed freely and open source, Scilab is currently being used in educational and industrial environments around the world. Scilab includes hundreds of mathematical functions with the possibility to add interactively programs from various languages (C, Fortran...). It has sophisticated data structures (including lists, polynomials, rational functions, linear systems...), an interpreter and a high level programming language. Scilab can be run using a variety of OS like UNIX, Linux, Windows(9X/2000/XP), etc. II. How to insta ll 1. System Requirements Scilab is distributed in source code format; binaries for Windows95/NT systems and several popular Unix/Linux-XWindow systems are also available: Dec Alpha (OSF V4), Dec Mips (ULTRIX 4.2), Sun Sparc stations (Sun OS), Sun Sparc stations (Sun Solaris), HP9000 (HP-UX V10), SGI Mips Irix, PC Linux. All of these binaries versions include tk/tcl interface. The installation requirements are the following :  for the source version: Scilab requires approximately 130Mb of disk storage to unpack and install (all sources included). You need X Window (X11R4, X11R5 or X11R6, C compiler and Fortran compiler (e.g. f2c or g77 or Visual C++ for Windows systems).  for the binary version: the minimum for running Scilab (without sources) is about 40 Mb when decompressed. These versions are partially statically linked and in principle do not require a fortran compiler. 2. Install Scilab
13

How to Sci Lab

Apr 09, 2018

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: How to Sci Lab

8/8/2019 How to Sci Lab

http://slidepdf.com/reader/full/how-to-sci-lab 1/13

1

SCILAB

An overview of Scilab’s int roduction, h ow to inst all, how to use an d sm all dem o 

 program.

I. Introduction

SCILAB is a free scientific software for engineering and scientific applications.

It bases on a numerical, programming and graphics environment; similar in operation

but different synt ax from MATLAB.

This is a self-contained package developed since 1990 by researchers from

INRIA and ENPC (France); it is now maintained and developed by Scilab Consortium

since its creation in Ma y 2003.

Distributed freely and open source, Scilab is currently being used ineducational and indu strial environment s ar ound t he world.

Scilab includes hundreds of mathematical functions with the possibility to add

interactively programs from various languages (C, Fortran...). It has sophisticated data

structures (including lists, polynomials, rational functions, linear systems...), an

interpret er an d a h igh level programming language.

Scilab can be run using a variety of OS like UNIX, Linux,

Windows(9X/2000/XP), etc.

II. How to insta ll

1. System Requiremen ts

Scilab is dist ribut ed in source code format ; binar ies for Windows95/NT syst ems

an d severa l popular Unix/Linu x-XWindow system s a re a lso available: Dec Alpha (OSF

V4), Dec Mips (ULTRIX 4.2), Sun Spar c stat ions (Sun OS), Sun Spar c stat ions (Sun

Solaris), HP9000 (HP-UX V10), SGI Mips Irix, PC Linux. All of these binaries versions

include tk /tcl int erface.

The installation requirements are the following :

  for t he s ource version: Scilab r equires appr oximat ely 130Mb of disk 

stora ge to un pack a nd inst all (all sour ces included). You need X Window

(X11R4, X11R5 or X11R6, C compiler a nd Fort ra n compiler (e.g. f2c or g77

or Visual C++ for Wind ows system s).

  for th e binary version: th e minimu m for r un ning Scilab (with out sources)

is about 40 Mb when decompr essed. These versions ar e part ially sta tically

linked an d in prin ciple do not requ ire a fort ra n compiler.

2. Inst all Scilab

Page 2: How to Sci Lab

8/8/2019 How to Sci Lab

http://slidepdf.com/reader/full/how-to-sci-lab 2/13

2

The simp lest wa y to inst all an d u se Scilab is d ownload scilab-4.0.exe, run an d follow its

steps

After finish in sta lling:

II. How to use

  Editing a comma nd line

  ent er a comm an d line by typing after t he prompt , or

  usin g Scipad t o edit

  The Scilab window has the following Control buttons.

  Stop inter ru pts execut ion of Scilab and en ter s in pau se mode  

  Resume cont inues execut ion after a p au se enter ed as a comma nd in a fun ction

or genera ted by th e Stop butt on or Contr ol C.  

  Abort aborts execution after one (or severa l) pau se, and r etu rn s to top-level

prompt  

  Restart clears all variables and executes star tup files  

  Quit quit s Scilab  

  Kill kills Scilab sh ell script  

  Demos for int era ctive ru n of some demos  

  File Opera tions facility for loadin g functions or dat a int o Scilab, or execut ing

script files.  

  Help : invokes on-line help with t he t ree of th e man an d th e nam es of th e

corresponding items. It is possible to type directly help <item> in t he Scilab

window.  

Page 3: How to Sci Lab

8/8/2019 How to Sci Lab

http://slidepdf.com/reader/full/how-to-sci-lab 3/13

3

  Graphic Window : select active graphic window

  New buttons can be added by the addmenu comma nd.

  Sam ple Session for Beginner s

Notes: Scilab is case-sensit ive.

 // is not inter pret ed (it is a comm ent line).

  Matrix:

Page 4: How to Sci Lab

8/8/2019 How to Sci Lab

http://slidepdf.com/reader/full/how-to-sci-lab 4/13

4

 

Notes: The $ symbol sta nds for th e last row or las t column index of a m at rix or vector.

The colon sym bol sta nds for “all r ows” or “all colum ns ”.

  Function

We have th e result:

Page 5: How to Sci Lab

8/8/2019 How to Sci Lab

http://slidepdf.com/reader/full/how-to-sci-lab 5/13

5

 

  Boolean Matrices

Boolean const an ts a re %t an d %f. They can be used in boolean m at rices. The synt ax is

th e same a s for ordina ry ma tr ices i.e. they can be concat ena ted, tr an sposed, etc...

Operat ions symbols used with boolean ma tr ices or u sed to creat e boolean m at rices are

== and ˜=

-->%t

%t =

T

-->[1,2]==[1,3]

ans =

T F

-->[1,2]==1

ans =

T F

-->a=1:5; a(a>2)

ans =

3. 4. 5.

-->A=[%t,%f,%t,%f,%f,%f];

-->B=[%t,%f,%t,%f,%t,%t]

B =

T F T F T T

-->A| B

ans =

Page 6: How to Sci Lab

8/8/2019 How to Sci Lab

http://slidepdf.com/reader/full/how-to-sci-lab 6/13

6

T F T F T T

-->A&B

ans =

T F T F F F

  Integer ma trices:

There a re 6 integer dat a types defined in Scilab,

  32 bit signed integers (int 32)  

  32 bit un signed int egers (uint32)  

  16 bit signed integers (int 16)  

  16 bit un signed int egers (uint16)  

  8 bit signed integers (int8)  

 8 bit un signed integers (uint8)

e.g.

  Matrix Operat ions

Page 7: How to Sci Lab

8/8/2019 How to Sci Lab

http://slidepdf.com/reader/full/how-to-sci-lab 7/13

7

 

  Exit from Scilab. 

-->quit

  Pr ogra mm ing: You can open Scipad t o writ e your program

  Pr ogra mm ing Tools: Scilab su pports a full list of program ming t ools

  loops, (for , while )

  conditionals, (==, <=, >=, <> or ˜=)

  case selection, an d

  crea tion new functions.

  Special Fu nction Comm an ds: Scilab ha s several special comma nds wh ich a re

used a lmost exclusively in functions. These ar e:

  argn: retur ns th e number of input a nd output argum ents for th e fun ction  

  error: used to suspen d th e operat ion of a function, to prin t a n err or

messa ge, an d to retu rn t o th e previous level of environment when a n err or

is detected.  

Page 8: How to Sci Lab

8/8/2019 How to Sci Lab

http://slidepdf.com/reader/full/how-to-sci-lab 8/13

8

  warning,  

  pau se: tem porarily suspen ds th e opera tion of a function.

  brea k: forces the en d of a loop  

  retu rn or r esume : used to retu rn to the calling environment and to pass

local var iables from th e fun ction environment to th e calling environment .

  SCICOS: Scicos is a Scilab toolbox included in t he Scilab Pa ckage. Writ ten in

Fortr an , C a nd Scilab lan guage, it comes with complete source code. Scicos provides

ma ny functiona lities available in Simulink and SystemBuild .

Page 9: How to Sci Lab

8/8/2019 How to Sci Lab

http://slidepdf.com/reader/full/how-to-sci-lab 9/13

9

 

Palettes:

Sources

Sinks

Linear

Page 10: How to Sci Lab

8/8/2019 How to Sci Lab

http://slidepdf.com/reader/full/how-to-sci-lab 10/13

10

 

Non-linear

Events

Threshold

Page 11: How to Sci Lab

8/8/2019 How to Sci Lab

http://slidepdf.com/reader/full/how-to-sci-lab 11/13

11

 

Others

Branching

Electrical

Page 12: How to Sci Lab

8/8/2019 How to Sci Lab

http://slidepdf.com/reader/full/how-to-sci-lab 12/13

12

ThermoHydraulics

Old Blocks

DemoBlocks

Notes

Scilab doesn’t ha ve as ma ny blocks a s Mat lab.

Scilab doesn’t ha ve Visua lize GUI as Mat lab.

Scilab ha s ma ny demos for u s t o self-study:

Page 13: How to Sci Lab

8/8/2019 How to Sci Lab

http://slidepdf.com/reader/full/how-to-sci-lab 13/13

13

 

Although both types of file (`sce' files an d `sci' files) contain code, th ey ar e differen t. `sce'

files ar e execut ed while `sci' files are loaded t o be used wh en we n eed th em.

III. Useful Link s

http://www.scilab.org/  

http://scilabsoft.inria.fr/  

http://www.scicos.org/  

http://www.infoclearinghouse.com/Merchant2/merchant.mv?Screen=CTGY&Category_

Code=S