Introduction to Scilab
-
Upload
verticalspin104 -
Category
Documents
-
view
117 -
download
5
Transcript of Introduction to Scilab
Introduction to ScilabUse Scilab, not Matlab
Kannan M. MoudgalyaIIT Bombay
Coordinator Training10,000 Teacher Training Programme
IIT BombayJune 2012
Kannan Moudgalya Use Scilab, not Matlab 1/68
Outline
I Open Source Software
I History of Scilab
I Usage of Scilab
I Comparing other open source softwaresystems
Kannan Moudgalya Use Scilab, not Matlab 2/68
FOSS: Free and Open Source Software
I Commercial software is expensiveI Heavy penalties if unauthorised software
is used by industryI Stories from Italy, HLL, WIPRO
I Our SME’s don’t use ANY software:I commercial software is expensiveI they are not aware of open source software
I Makes small companies uncompetitive
I There is no alternative to open sourcesoftware
Kannan Moudgalya Use Scilab, not Matlab 3/68
Scilab
I A good substitute for Matlab
I About 95% compatibility
Kannan Moudgalya Use Scilab, not Matlab 4/68
What is Scilab?
I Free and open source
I Easy to useI Excellent computational environment:
I LINPACK, EISPACK, LAPACK: same asMatlab
I Other software not available for Matlab:Dassl, ODEPACK, etc.
Kannan Moudgalya Use Scilab, not Matlab 5/68
Scilab is created for mathematicians
I Matrices and vectors can be createdeasily - no typing, storage allocation, etc.
I Matrix-vector product,scalar-vector/matrix products are writtenwithout any fuss - like themathematicians do
I Belongs to Matlab family - originallycreated by Prof. Cleve Moler, who hadworked on Linpack and Eispack projects
Kannan Moudgalya Use Scilab, not Matlab 6/68
History of Scilab
I Prof. Cleve Moler created Matlabthrough NSF funding
I As Government funded, source code hadto be made available
I Many companies started using this ideaI Matrixx
I CTRL-CI MatlabI Scilab
I Used extensively for linear algebra,simulation, control system design
I Scilab - a recent story
Kannan Moudgalya Use Scilab, not Matlab 7/68
Scilab - other features
I Can call programs written in Fortran, C
I Good graphics capability
I Large installed base
I A lot of algorithms implemented ininterpreted language as well
I Free
I Check out www.scilab.org orwww.scilab.in
Kannan Moudgalya Use Scilab, not Matlab 8/68
How reliable is Scilab?
I CNES - France’s ISRO
I CNES Arianne rockets
I CNES relies on Scilab for many criticalcalculations:trajectory, flight dynamics, orbit
Kannan Moudgalya Use Scilab, not Matlab 9/68
CNES Talk
I Use of Scilab for Space Mission Analysisand Flight Dynamics Activities
I by Thierry Martin
I Senior Manager, CNES
Kannan Moudgalya Use Scilab, not Matlab 10/68
Purchase of Matlab at IIT Bombay - AStory
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 =
4.
c =
12.
a+b+c
ans =
22.Kannan Moudgalya Use Scilab, not Matlab 13/68
Useful Commands
I demosI Gives demos on several different things
I aproposI Helps locate commands associated with a
word
I helpI functional invocation with no arguments
I Helps draw plots
I diaryI 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
y =
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 =
! 1. 2. 3. 4. 5. !
b =
! 1. 3. 5. 7. 9. !
-->c = [b a]
c =
! 1. 3. 5. 7. 9. 1. 2. 3. 4. 5. !Kannan Moudgalya Use Scilab, not Matlab 17/68
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 =
! 1. 2. 3. 4. 5. !
b =
! 1. 3. 5. 7. 9. !
-->a - 2
Kannan Moudgalya Use Scilab, not Matlab 19/68
Vector Operation - 3 II
ans =
! - 1. 0. 1. 2. 3. !
-->2*a-b
ans =
! 1. 1. 1. 1. 1. !
Kannan Moudgalya Use Scilab, not Matlab 20/68
Logical Operators
== equal to< less than> greater than<= less than or equal to>= greater than or equal to<> or ∼= not equal to
Kannan Moudgalya Use Scilab, not Matlab 21/68
Vector Operations Using LogicalOperators I
-->A = 1:9, B = 9-A
A =
! 1. 2. 3. 4. 5. 6. 7. 8. 9. !
B =
! 8. 7. 6. 5. 4. 3. 2. 1. 0. !
-->tf = A==B
Kannan Moudgalya Use Scilab, not Matlab 22/68
Vector Operations Using LogicalOperators 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. 2. 3. !
! 4. 5. 6. !
! 7. 8. 9. !
-->A(3,3)=0
Kannan Moudgalya Use Scilab, not Matlab 26/68
Submatrix II
A =
! 1. 2. 3. !
! 4. 5. 6. !
! 7. 8. 0. !
Kannan Moudgalya Use Scilab, not Matlab 27/68
Submatrix I
A
A =
! 1. 2. 3. !
! 4. 5. 6. !
! 7. 8. 0. !
-->B=A(3:-1:1,1:3)
Kannan Moudgalya Use Scilab, not Matlab 28/68
Submatrix II
B =
! 7. 8. 0. !
! 4. 5. 6. !
! 1. 2. 3. !
Kannan Moudgalya Use Scilab, not Matlab 29/68
Submatrix
-->A
A =
! 1. 2. 3. !
! 1. 4. 7. !
! 7. 8. 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. - 3. !
! 2. - 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)
y =
! 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
I Capability comparison - a correctquestion?
I Is Matlab required for class students?
I Matlab and versions
I Mathworks: 2,000 employees
I Scilab: 23 full time employees
Kannan Moudgalya Use Scilab, not Matlab 39/68
Hardware Interfacing through FOSS
I ScilabI Xcos, HART, COMEDI
I GNURadio
Kannan Moudgalya Use Scilab, not Matlab 40/68
Scilab for Hardware Interfacing
I COMEDI has device drivers for 150 A/Dand Digital I/O cards
I We can call ALL of them from ScilabI Using Xcos (' Simulink), HART
I Devices not in COMEDI, but with Cdrivers
I Devices without device drivers
Kannan Moudgalya Use Scilab, not Matlab 41/68
GNURadio for Hardware Interfacing
I Open source software
I Uses C++ and Python
I Can call OpenCVI Has graphic front end
I Has sliders, etc. - allows change ofparameters in real time
I Calling Scilab functions from GNURadioI Calling Xcos functions from GNURadio
I LabView does not allow Simulink calls!
Kannan Moudgalya Use Scilab, not Matlab 42/68
Control of Single Board Heater Systemthrough Scilab and GNURadio
Kannan Moudgalya Use Scilab, not Matlab 43/68
Replacement for ORCAD?
I KiCAD + NGSpice + ... – a replacementfor 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
I Help code lab assignments into ScilabI Examples:
I IIT BombayI Delhi UniversityI SASTRA UniversityI Anna UniversityI The list is growing
Kannan Moudgalya Use Scilab, not Matlab 48/68
Problems with open source software
I Good documents are missing
I Lack of support
I 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
I Creation of documents is difficult
I Code creation is easier
I Create code for existing documents
Kannan Moudgalya Use Scilab, not Matlab 51/68
Textbook Companion Project
I Choose any standard textbook
I Code worked out examples into Scilab
I Get the correctness certified by thesubject expert
I Get honorarium - Rs. 10,000
I Summer internship to create textbookcompanion
I See the web page
Kannan Moudgalya Use Scilab, not Matlab 52/68
Internship project during summer of 2010
I Fluid mechanics by Fox and McDonald -NIT Trichy, 4th year B.E. student
I Control system design by Smarajit Ghosh- NIT Srinagar, 4th year B.E. student
I Engg. mathematics by Kreyszig - BITRanchi, 2nd year B.E. student
I Three more created by IIT Bombaystudents
Kannan Moudgalya Use Scilab, not Matlab 53/68
Textbook companions created by CollegeProfessors
I Prof. Raajan, SASTRA UniversityI Digital image processing by Gonsalves
I Prof. Senthilkumar, IRTT, ErodeI Signals and Systems by Oppenheim, Willsky
and YoungI DSP by Proakis and ManolakisI Optical communication by KeiserI Electromagnetics - in pipeline
Kannan Moudgalya Use Scilab, not Matlab 54/68
List of books for companion project
I Completed books - 100
I Books in progress - 50
I Expect many summer interns to do this
I See the web page
Kannan Moudgalya Use Scilab, not Matlab 55/68
Availability
I Every textbook companion is available asa pdf file
I Can be downloaded free of cost fromscilab.in
I Can be printed as a book as well -samples will be shown to you
I Need the original textbook to understand
I No copyright violation
Kannan Moudgalya Use Scilab, not Matlab 56/68
Spoken Tutorials
Kannan Moudgalya Use Scilab, not Matlab 57/68
Spoken Tutorials
I It is an instructional methodology
I Based on IT
I Available also in local languages
I Available free of cost - thanks to MHRDfunding
I Will help bridge digital divide
I Make our country IT literate
I 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?
I It is a recording of a computer session,along with a running commentary
I It is an audio-video tutorial
I It is typically ten minutes long
I 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
I Outline for a software by an expert
I Script for a tutorial by an expert
I Novice check
I Recording
I Verification and acceptance
I Translation of spoken part into otherlanguages
I Dubbing the voice
Kannan Moudgalya Use Scilab, not Matlab 62/68
Dubbing into Our Languages
I Dub only audio
I Video remains the same
I If original spoken tutorial is made properly,dubbing is easy
Kannan Moudgalya Use Scilab, not Matlab 63/68
Benefits of dubbing
I Useful for students weak in EnglishI esp. school students in vernacular medium
I Can provide high technology solutions toeven minority population groups
Kannan Moudgalya Use Scilab, not Matlab 64/68
Sample Tutorials in Our Languages
Assamese (dubbing) Bodo (geo)Bengali (Sci) Bhojpuri (dubbing)Indian English (PHP) Gujarati (Xfig)Hindi (Linux) Kannada (CS)Khasi (CS) Konkani (CS)Malayalam (dubbing) Marathi (Sci)Mythili (CS) Oriya (dubbing)Rajasthani (CS) Sanskrit (LATEX)Sindhi (CS) Tamil (LATEX)Telugu (Sci) Urdu (Sci)
Kannan Moudgalya Use Scilab, not Matlab 65/68
Conclusion
I Open source efforts are not only idealistic,but make economic and commercial senseas well
I It has a potential to empower ALL Indianchildren to collaborate and make us adeveloped nation
I IIT Bombay is working on several opensource projects
I We invite you to join us
Kannan Moudgalya Use Scilab, not Matlab 66/68
Funding for our work
I Funded by National Mission on Educationthrough ICT, MHRD, Government ofIndia
I http://spoken-tutorial.org/NMEICT-Intro
Kannan Moudgalya Use Scilab, not Matlab 67/68
Thanks
I [email protected] http://spoken-tutorial.org
/What is a spoken tutorial
Kannan Moudgalya Use Scilab, not Matlab 68/68