Control Systems Lab 1
Control Systems Lab 1
1 Objectives
2 List of equipment/software
Personal Computer
Installation of SCILAB
3.1 Variable
In Scilab, you can easily create and instantiate variables anytime. Unlike the C
language, Scilabs variables are dynamic and dont have to be created before they
are stored with values.
with
[ ]
1 2 3
4 5 6
7 8 9
Description
Matrix addition
Matrix subtraction
Matrix Multiplication
Matrix division.
A / B= AB
Matrix back-division.
A = A1B
Matrix exponential.
Transpose
If you want element-wise operation using those operators, the operator is preceded
with a .
--> a = [1, 2; 3, 4]
--> b = [3, 4; 5, 6]
--> a + b
ans =
4.
6.
8.
10.
4. Do a matrix multiplication and element-wise multiplication on a and b.
What are the results? Are the results equal?
5. What is the result of a?
Accessing an element in an array or matrix is by calling the variable with a
parenthesis. For example, to access the 1st element of b:
13.
16.
29.
36.
a.*b
ans =
3.
8.
15.
24.
5. a'
ans =
1.
3.
2.
4.
6. c(1:3,$)
ans =
3.
6.
9.
7. a = [0:0.1:2*%pi] //is registering values unto variable a
b = this is executed after a=1 //syntax error
!--error 2
Invalid factor.
8. Note that the first 3 lines are in myfunct.sci file to be executed in the console
before calling myfunct.
-->function [x] = myfunct(A,B)
-->x=(A+B)*B
-->endfunction
-->myfunct(1,1)
ans=1
9. -->myfunct(3,9)
ans =
108.
10. Initially the given parameters do not fit in the function since it is programmed to
receive only two inputs. It is expected to result to an error.
-->myfucnt[1,2,3]
!--error 4
Undefined variable: myfucnt
-->myfunct[4; 6;7]
4 Conclusion
The Scilab is a freeware where most engineering applications in programming is
performed. I have learned that this software is capable to compute arithmetic
equations. large number of arrays depending on computers memory, even
polynomials finding the roots. In short, this is a tool to simplify problems that are
difficult and time-consuming to compute in real life.