Professional Documents
Culture Documents
Syllabus
Introduction & simple operations
Matrix, Statistical description and analysis of data
Flow control (script files; for/done, if/else)
User-defined functions
Plots & Random Numbers
University Holiday
Bisection method
Practical Test 1 (Lectures 1-4)
Newton-Raphson method
More programming examples
Solving differential equations I
Solving differential equations II
Fourier Analysis
Project Presentation
Practical Test 2 (All lectures)
Assessment Tasks/Activities
Practical Tests: 60% (20% PT1 & 35% PT2 & 5% small
tests)
Assignments and lab reports: 40% (10% project, 30%
homework)
75% lecture attendance rate must be obtained. Marks will
be deducted for students failing to meet the attendance
requirement.
Homework due: 9 am Monday in class, hard copy
Homework late policy: 10% off per day
Recommended Reading
Reference Book(s):
Essential MATLAB for Scientists and Engineers, 2nd/3rd/4 th/5th Edition, by
Brian D. Hahn.
als
Introduction to Scilab (introscilab.pdf)
Scilab for very beginners (Scilab_beginners.pdf)
Programmable Calculator
Scilab
www.scilab.org
Canvas
Windows
Mac
Linux
Scilab interface
Variable
s
Director
y
&
files
Comma
nd Input
Interfac
e
Comma
nd
history
Ihear, I forget
Isee, I remember
Ido, I learn
7
Help
Editor
1)
2)
3)
4)
>editor
Type
:
Review of lecture 1
Creating a variable
Comments (//)/continuation(..)
Elementary mathematical functions
Boolean (%T, %F)
Complex numbers
Integer
Strings (test, +)
Dynamic variables
Variable names
Variable names may be as long as the user
as %pi
Comments:
Continuation lines:
any line which ends with two dots
..
Other functions
Booleans
Boolean variables can store
true (%t, or %T) or false (%f, or %F) values.
Complex numbers
In Scilab, %i represents the mathematical
imaginary number i
i 1?
2
is used
to compute
the
conjugate
real
returns real
part
imag
returns
imaginary
Integers
Integer type:
Number of bits used to store an
Strings
Strings can be stored in variables, provided that
they are delimited by double quotes .
+ can operate strings.
Review of lecture 1
Creating a variable
Comments (//)/continuation(..)
Elementary mathematical functions
Boolean (%T, %F)
Complex numbers
Integer
Strings (test, +)
Dynamic variables
Create a Matrix
Or, 2nd way: blank space separates the
Functions generating
matrices
Empty matrix
A=[ ] create a 0X0/empty matrix, this
Query matrices
size returns the two output arguments nr
j, step s
Hilbert
matrix
and n columns
dynamically
Low-level operations
+, -, *, /
XB=A
=> X=A/B=AB-1
AX=B => X=A\B=A-1B
Elementwise operations
If a dot . is written before an operator, it
Elementwise operators
conjugates
Elementary single quote . only transpose,
no conjugating the matrix, be it real or
complex.
Elementary functions
Elementary functions
Function: sum
-->sum(a, 1)
or
-->sum(a,c')
ans =
12. 15. 18.
-->sum(a,r')
ans =
6.
15.
24.
Average value of X
mean(x)=
=4.6
x= [-2,3,5,8,9]
m ean(x)
m edian(x)
Median--Mid value of x
Median in rows
-->median(a,'r')
ans =
9. 10. 11.
Median in columns
-->median(a,'c')
ans =
2.5
6.5
10.5
14.5
18.5
12.
a=[1:4;5:8;9:12;13:16;
17:20]
a =
1.
2.
3.
4.
5.
6.
7.
8.
9.
10. 11. 12.
13. 14. 15. 16.
a=[1:4;5:8;9:12;13:16;
17. 18. 19. 20.
17:20];
m ean(a)
m edian(a)
-->mean(a)
ans =
10.5
->median(a)
ans =
10.5
-->stdev(a)
ans =
Normal distribution
689599.7 rule
Example
A ready-mix concrete company has three
Solution
Home Work-2
Due: 9am, Sep. 14 2015
Late policy: 10% off per day
To be submitted online to Canvas.
following?
following?
following?
following?
following?
following?
following?
following?
Learn Sort/length/size/sum/prod