Introduction to Scilab Use Scilab, not Matlab
Kannan M. Moudgalya IIT Bombay kannan@iitb.ac.in
Coordinator Training 10,000 Teacher Training Programme IIT Bombay June 2012
Kannan Moudgalya Use Scilab, not Matlab 1/68
Outline
Open Source Software History of Scilab Usage of Scilab Comparing other open source software systems
Kannan Moudgalya
Use Scilab, not Matlab
2/68
FOSS: Free and Open Source Software
Commercial software is expensive Heavy penalties if unauthorised software is used by industry
Stories from Italy, HLL, WIPRO
Our SMEs dont use ANY software:
commercial software is expensive they are not aware of open source software
Makes small companies uncompetitive There is no alternative to open source software
Kannan Moudgalya Use Scilab, not Matlab 3/68
Scilab
A good substitute for Matlab About 95% compatibility
Kannan Moudgalya
Use Scilab, not Matlab
4/68
What is Scilab?
Free and open source Easy to use Excellent computational environment:
LINPACK, EISPACK, LAPACK: same as Matlab Other software not available for Matlab: Dassl, ODEPACK, etc.
Kannan Moudgalya
Use Scilab, not Matlab
5/68
Scilab is created for mathematicians
Matrices and vectors can be created easily - no typing, storage allocation, etc. Matrix-vector product, scalar-vector/matrix products are written without any fuss - like the mathematicians do Belongs to Matlab family - originally created by Prof. Cleve Moler, who had worked on Linpack and Eispack projects
Kannan Moudgalya
Use Scilab, not Matlab
6/68
History of Scilab
Prof. Cleve Moler created Matlab through NSF funding As Government funded, source code had to be made available Many companies started using this idea
Matrixx CTRL-C Matlab Scilab
Used extensively for linear algebra, simulation, control system design Scilab - a recent story
Kannan Moudgalya Use Scilab, not Matlab 7/68
Scilab - other features
Can call programs written in Fortran, C Good graphics capability Large installed base A lot of algorithms implemented in interpreted language as well Free Check out www.scilab.org or www.scilab.in
Kannan Moudgalya
Use Scilab, not Matlab
8/68
How reliable is Scilab?
CNES - Frances ISRO CNES Arianne rockets CNES relies on Scilab for many critical calculations: trajectory, ight dynamics, orbit
Kannan Moudgalya
Use Scilab, not Matlab
9/68
CNES Talk
Use of Scilab for Space Mission Analysis and Flight Dynamics Activities by Thierry Martin Senior Manager, CNES
Kannan Moudgalya
Use Scilab, not Matlab
10/68
Purchase of Matlab at IIT Bombay - A Story
Kannan Moudgalya
Use Scilab, not Matlab
11/68
Usage of Scilab
Kannan Moudgalya
Use Scilab, not Matlab
12/68
Simple Arithmetic - 1
4+6+12 ans = 22.
a = 4, b = 6; c = 12 a c = 4. = 12. a+b+c ans =
Kannan Moudgalya Use Scilab, not Matlab 13/68
Useful Commands
demos
Gives demos on several dierent things
apropos
Helps locate commands associated with a word
help functional invocation with no arguments
Helps draw plots
diary
Stores all commands and resulting outputs
Kannan Moudgalya
Use Scilab, not Matlab
14/68
Simple Arithmetic & Display
a = 4; b = 6; c = 12; d = a+b+c d = 22.
d = a+b+c; d d = 22.
Kannan Moudgalya Use Scilab, not Matlab 15/68
Simple Arithmetic
x = sqrt(2)/2, y = asin(x) x = 0.7071068 = 0.7853982 y_deg = y * 180 /%pi y_deg 45. =
Kannan Moudgalya Use Scilab, not Matlab 16/68
Vector Operation - 2 I
-->a = 1:5, b = 1:2:9
a ! b !
= 1. = 1. 3. 5. 7. 9. ! 2. 3. 4. 5. !
-->c = [b a]
c = ! 1.
3.
5.
Kannan Moudgalya
7.
9.
1.
17/68
2.
3.
Use Scilab, not Matlab
Vector Operation - 2 II
-->d = [b(1:2:5) 1 0 1]
d !
= 1.
5.
9.
1.
0.
1. !
Kannan Moudgalya
Use Scilab, not Matlab
18/68
Vector Operation - 3 I
-->a, b
a ! b !
= 1. = 1. 3. 5. 7. 9. ! 2. 3. 4. 5. !
-->a - 2
Kannan Moudgalya
Use Scilab, not Matlab
19/68
Vector Operation - 3 II
ans = ! - 1. -->2*a-b
0.
1.
2.
3. !
ans !
= 1.
1.
1.
1.
1. !
Kannan Moudgalya
Use Scilab, not Matlab
20/68
Logical Operators
== < > <= >= <> or =
equal to less than greater than less than or equal to greater than or equal to not equal to
Kannan Moudgalya
Use Scilab, not Matlab
21/68
Vector Operations Using Logical Operators I
-->A = 1:9, B = 9-A
A ! B !
= 1. = 8. 2. 7. 3. 6. 4. 5. 5. 4. 6. 3. 7. 2.
-->tf = A==B
Kannan Moudgalya Use Scilab, not Matlab 22/68
Vector Operations Using Logical Operators II
tf = ! F F F F F F F F F ! -->tf = A>B
tf = ! F F F F T T T T T !
Kannan Moudgalya
Use Scilab, not Matlab
23/68
Transpose I
-->c = [1;2;3]
c ! ! !
= 1. ! 2. ! 3. !
-->a=1:3
Kannan Moudgalya
Use Scilab, not Matlab
24/68
Transpose II
a ! = 1. 2. 3. !
-->b = a
b ! ! !
= 1. ! 2. ! 3. !
Kannan Moudgalya
Use Scilab, not Matlab
25/68
Submatrix I
-->A=[1 2 3;4 5 6;7 8 9]
A ! ! !
= 1. 4. 7. 2. 5. 8. 3. ! 6. ! 9. !
-->A(3,3)=0
Kannan Moudgalya Use Scilab, not Matlab 26/68
Submatrix II
A ! ! !
= 1. 4. 7. 2. 5. 8. 3. ! 6. ! 0. !
Kannan Moudgalya
Use Scilab, not Matlab
27/68
Submatrix I
A
A ! ! !
= 1. 4. 7. 2. 5. 8. 3. ! 6. ! 0. !
-->B=A(3:-1:1,1:3)
Kannan Moudgalya Use Scilab, not Matlab 28/68
Submatrix II
B ! ! !
= 7. 4. 1. 8. 5. 2. 0. ! 6. ! 3. !
Kannan Moudgalya
Use Scilab, not Matlab
29/68
Submatrix
-->A A ! ! ! = 1. 1. 7. 2. 4. 8. 3. ! 7. ! 0. !
-->B=A(:,2) B ! ! ! = 2. ! 4. ! 8. !
Kannan Moudgalya Use Scilab, not Matlab 30/68
Submatrix I
-->b=[5 -3;2 -4]
b ! !
= 5. 2.
- 3. ! - 4. !
-->x=abs(b)>2
Kannan Moudgalya
Use Scilab, not Matlab
31/68
Submatrix II
x = ! T T ! ! F T ! -->y=b(abs(b)>2)
= ! 5. ! ! - 3. ! ! - 4. !
Kannan Moudgalya
Use Scilab, not Matlab
32/68
Special Matrices I
-->zeros(3,3)
ans ! ! !
= 0. 0. 0.
0. 0. 0.
0. ! 0. ! 0. !
-->ones(2,4)
Kannan Moudgalya
Use Scilab, not Matlab
33/68
Special Matrices II
ans = ! 1. ! 1. 1. 1. 1. 1. 1. ! 1. !
-->rand(2,1)
ans = ! 0.2113249 ! ! 0.7560439 !
Kannan Moudgalya
Use Scilab, not Matlab
34/68
Go for Vector Computation
Kannan Moudgalya
Use Scilab, not Matlab
35/68
Go for Vector Computation I
-->a = ones(10000,1); -->timer()
ans
= 0.02
-->for i = 1:10000, b(i)=a(i)+a(i); end -->timer()
Kannan Moudgalya
Use Scilab, not Matlab
36/68
Go for Vector Computation II
ans = 0.31
-->c = a+a; -->timer()
ans
= 0.03
Kannan Moudgalya
Use Scilab, not Matlab
37/68
Plots
Go through the
Demos!
Kannan Moudgalya
Use Scilab, not Matlab
38/68
Comparing Matlab and Scilab
Capability comparison - a correct question? Is Matlab required for class students? Matlab and versions Mathworks: 2,000 employees Scilab: 23 full time employees
Kannan Moudgalya
Use Scilab, not Matlab
39/68
Hardware Interfacing through FOSS
Scilab
Xcos, HART, COMEDI
GNURadio
Kannan Moudgalya
Use Scilab, not Matlab
40/68
Scilab for Hardware Interfacing
COMEDI has device drivers for 150 A/D and Digital I/O cards We can call ALL of them from Scilab
Using Xcos ( Simulink), HART
Devices not in COMEDI, but with C drivers Devices without device drivers
Kannan Moudgalya
Use Scilab, not Matlab
41/68
GNURadio for Hardware Interfacing
Open source software Uses C++ and Python Can call OpenCV Has graphic front end
Has sliders, etc. - allows change of parameters in real time
Calling Scilab functions from GNURadio Calling Xcos functions from GNURadio
LabView does not allow Simulink calls!
Kannan Moudgalya
Use Scilab, not Matlab
42/68
Control of Single Board Heater System through Scilab and GNURadio
Kannan Moudgalya
Use Scilab, not Matlab
43/68
Replacement for ORCAD?
KiCAD + NGSpice + ... a replacement for ORCAD?
Kannan Moudgalya
Use Scilab, not Matlab
44/68
SAGE - a Replacement for Mathematica
Kannan Moudgalya
Use Scilab, not Matlab
45/68
OpenFoam - a Replacement for Fluent
Kannan Moudgalya
Use Scilab, not Matlab
46/68
Other Projects
Kannan Moudgalya
Use Scilab, not Matlab
47/68
Lab migration project: Matlab to Scilab
Help code lab assignments into Scilab Examples:
IIT Bombay Delhi University SASTRA University Anna University The list is growing
Kannan Moudgalya
Use Scilab, not Matlab
48/68
Problems with open source software
Good documents are missing Lack of support Wrong impression about the quality
Kannan Moudgalya
Use Scilab, not Matlab
49/68
Textbook Companion Project
Kannan Moudgalya
Use Scilab, not Matlab
50/68
Textbook Companion Project
Creation of documents is dicult Code creation is easier Create code for existing documents
Kannan Moudgalya
Use Scilab, not Matlab
51/68
Textbook Companion Project
Choose any standard textbook Code worked out examples into Scilab Get the correctness certied by the subject expert Get honorarium - Rs. 10,000 Summer internship to create textbook companion See the web page
Kannan Moudgalya
Use Scilab, not Matlab
52/68
Internship project during summer of 2010
Fluid mechanics by Fox and McDonald NIT Trichy, 4th year B.E. student Control system design by Smarajit Ghosh - NIT Srinagar, 4th year B.E. student Engg. mathematics by Kreyszig - BIT Ranchi, 2nd year B.E. student Three more created by IIT Bombay students
Kannan Moudgalya
Use Scilab, not Matlab
53/68
Textbook companions created by College Professors
Prof. Raajan, SASTRA University
Digital image processing by Gonsalves
Prof. Senthilkumar, IRTT, Erode
Signals and Systems by Oppenheim, Willsky and Young DSP by Proakis and Manolakis Optical communication by Keiser Electromagnetics - in pipeline
Kannan Moudgalya
Use Scilab, not Matlab
54/68
List of books for companion project
Completed books - 100 Books in progress - 50 Expect many summer interns to do this See the web page
Kannan Moudgalya
Use Scilab, not Matlab
55/68
Availability
Every textbook companion is available as a pdf le Can be downloaded free of cost from scilab.in Can be printed as a book as well samples will be shown to you Need the original textbook to understand No copyright violation
Kannan Moudgalya
Use Scilab, not Matlab
56/68
Spoken Tutorials
Kannan Moudgalya
Use Scilab, not Matlab
57/68
Spoken Tutorials
It is an instructional methodology Based on IT Available also in local languages Available free of cost - thanks to MHRD funding Will help bridge digital divide Make our country IT literate Make our children employable
Kannan Moudgalya
Use Scilab, not Matlab
58/68
Demo of creating a spoken tutorial
Kannan Moudgalya
Use Scilab, not Matlab
59/68
What is a Spoken Tutorial?
It is a recording of a computer session, along with a running commentary It is an audio-video tutorial It is typically ten minutes long Suitable for self learning
Kannan Moudgalya
Use Scilab, not Matlab
60/68
Target Audience
A remote child, working alone, at midnight, without anyone to help her
Kannan Moudgalya
Use Scilab, not Matlab
61/68
Steps in creating spoken tutorials
Outline for a software by an expert Script for a tutorial by an expert Novice check Recording Verication and acceptance Translation of spoken part into other languages Dubbing the voice
Kannan Moudgalya
Use Scilab, not Matlab
62/68
Dubbing into Our Languages
Dub only audio Video remains the same If original spoken tutorial is made properly, dubbing is easy
Kannan Moudgalya
Use Scilab, not Matlab
63/68
Benets of dubbing
Useful for students weak in English
esp. school students in vernacular medium
Can provide high technology solutions to even minority population groups
Kannan Moudgalya
Use Scilab, not Matlab
64/68
Sample Tutorials in Our Languages
Assamese (dubbing) Bengali (Sci) Indian English (PHP) Hindi (Linux) Khasi (CS) Malayalam (dubbing) Mythili (CS) Rajasthani (CS) Sindhi (CS) Telugu (Sci) Bodo (geo) Bhojpuri (dubbing) Gujarati (Xg) Kannada (CS) Konkani (CS) Marathi (Sci) Oriya (dubbing) A Sanskrit (LTEX) A Tamil (LTEX) Urdu (Sci)
Kannan Moudgalya
Use Scilab, not Matlab
65/68
Conclusion
Open source eorts are not only idealistic, but make economic and commercial sense as well It has a potential to empower ALL Indian children to collaborate and make us a developed nation IIT Bombay is working on several open source projects We invite you to join us
Kannan Moudgalya
Use Scilab, not Matlab
66/68
Funding for our work
Funded by National Mission on Education through ICT, MHRD, Government of India http://spoken-tutorial.org/NMEICT-Intro
Kannan Moudgalya
Use Scilab, not Matlab
67/68
Thanks
kannan@iitb.ac.in http://spoken-tutorial.org /What is a spoken tutorial
Kannan Moudgalya
Use Scilab, not Matlab
68/68