0% found this document useful (0 votes)
53 views12 pages

14-Scilab Functions

Download as pdf or txt
Download as pdf or txt
Download as pdf or txt
You are on page 1/ 12

EMILIO AGUINALDO COLLEGE ISO 9001: 2015 CERTIFIED

QUALITY MANAGEMENT SYSTEM


City of Dasmariñas,Cavite

Scilab Functions

Reference:
- Sandeep Nagar, Introduction to Scilab For Engineers and Scientists

VIRTUE EXCELLENCE SERVICE


EMILIO AGUINALDO COLLEGE ISO 9001: 2015 CERTIFIED
QUALITY MANAGEMENT SYSTEM
City of Dasmariñas,Cavite

6.3 Functions

A function is a set of codes that can be called when required. As a result, it


can be defined separately either its own file or within the body of the
program.
A script file is similar in nature. A script file stores a sequence of commands
to be executed.
It seems that a function and a script have a similar nature, but, unlike
MATLAB and Octave, Scilab provides separate of files for each one of them.
This is based on the nature of their behavior with the core Scilab program.

VIRTUE EXCELLENCE SERVICE


EMILIO AGUINALDO COLLEGE ISO 9001: 2015 CERTIFIED
QUALITY MANAGEMENT SYSTEM
City of Dasmariñas,Cavite

6.3 Functions

Whereas a script file (with extension .sce) is an executable file, a function


file (with extension .sci) stores a set of instructions.
The function file behaves like a black box where input is fed and output is
obtained.
On the other hand, a script file changes its behavior as per input values.
Whatever input data a script file accesses is taken from the Scilab
workspace.
Output data from a script file is put into the Scilab workspace.
The semantics of input data, local variables, are visible only within the
function.

VIRTUE EXCELLENCE SERVICE


EMILIO AGUINALDO COLLEGE ISO 9001: 2015 CERTIFIED
QUALITY MANAGEMENT SYSTEM
City of Dasmariñas,Cavite

6.3 Functions

VIRTUE EXCELLENCE SERVICE


EMILIO AGUINALDO COLLEGE ISO 9001: 2015 CERTIFIED
QUALITY MANAGEMENT SYSTEM
City of Dasmariñas,Cavite

6.3 Functions

VIRTUE EXCELLENCE SERVICE


EMILIO AGUINALDO COLLEGE ISO 9001: 2015 CERTIFIED
QUALITY MANAGEMENT SYSTEM
City of Dasmariñas,Cavite

6.3 Functions

VIRTUE EXCELLENCE SERVICE


EMILIO AGUINALDO COLLEGE ISO 9001: 2015 CERTIFIED
QUALITY MANAGEMENT SYSTEM
City of Dasmariñas,Cavite

6.3 Functions

VIRTUE EXCELLENCE SERVICE


EMILIO AGUINALDO COLLEGE ISO 9001: 2015 CERTIFIED
QUALITY MANAGEMENT SYSTEM
City of Dasmariñas,Cavite

6.3 Functions

VIRTUE EXCELLENCE SERVICE


EMILIO AGUINALDO COLLEGE ISO 9001: 2015 CERTIFIED
QUALITY MANAGEMENT SYSTEM
City of Dasmariñas,Cavite

6.3 Functions

VIRTUE EXCELLENCE SERVICE


EMILIO AGUINALDO COLLEGE ISO 9001: 2015 CERTIFIED
QUALITY MANAGEMENT SYSTEM
City of Dasmariñas,Cavite

6.3.1 Inline Functions

VIRTUE EXCELLENCE SERVICE


EMILIO AGUINALDO COLLEGE ISO 9001: 2015 CERTIFIED
QUALITY MANAGEMENT SYSTEM
City of Dasmariñas,Cavite

6.4 Summary

Defining functions is the key to modular programming. Scilab presents an


elegant way to define and use functions both inline and in separate files.
When combined with the ability to write functions inside a loop, complex
problems can be implemented in a few lines of codes.
It requires an artistic attitude while designing an algorithm where functions
and loops are the paintbrush to devise an elegant solution to a given
numerical problem.

VIRTUE EXCELLENCE SERVICE


EMILIO AGUINALDO COLLEGE ISO 9001: 2015 CERTIFIED
QUALITY MANAGEMENT SYSTEM
City of Dasmariñas,Cavite

Thank you for listening


God Bless

VIRTUE EXCELLENCE SERVICE

You might also like