Cheatography

# Scilab Cheat Sheet by BiONiCOP

Scilab basic cheat sheet.

### Scialb cheat sheet

 input user input. example: ``x=inpu­t("How many iterat­ion­s?")`` disp displays variables matrix example: ``[1 3 4 6;5 6 7 8]`` ',' means row & ';' means column repmat replic­ate's matrix. plot used to create plots in the plane. sqrt square root. modulo syntax: ``x (mod y)`` ones matrix made of ones. syntax: ``ones(x,y)`` Matrix of size x × y zeros matrix made of zeros. syntax: ``zeros(x,y)`` Matrix of size x × y rand Returns a real number randomly taken between 0 and 1. function syntax: ``function [output arguments] = functi­onn­ame­(input arguments) instructions endfun­ction`` plot(x,y) graph of 'x' vs 'y'. plot2d plots a set of 2D curves. plot2d2 It is the same as plot2d but the functions given by (x,y) are supposed to be "­pie­cewise consta­nt". plot2d3 It is the same as plot2d but curves are plotted using "­ver­tical bars". plot2d4 It is the same as plot2d but curves are plotted using "­arrows style". fplot2d 2D function plot fplot3d 3D function plot. subplot() plots multiple graphs on a single graphic window. comet 2D comet animated plot. paramf­­plot2d animated plot of a 2D parame­­trized curve. strrev returns string reversed.

### Scilab cheat sheet

 deff It is an embedded scilab function for defining custom functions. The deff() function receives 2 argume­nts­(both strings). Each string contains parts of the function definition which are going to be evaluate by Scilab and turn into instru­ctions. example:``deff('­y=f­(x)­','­y=s­qrt(x.2 - 5*x + 6)')`` for: f(x)=√x2 − 5x + 6 complex complex number: syntax: ``x+%i`` This will dislay complex number x + i where, i = √−1 mopen opens a file in scilab. syntax: ``mopen(­SCI­+'/­fil­e.txt', 'rt')`` mputl writes strings in a text file. syntax: ``r = mputl(txt, file_desc)`` mgetl reads lines from an text file. syntax: ``txt = mgetl(­fil­e_desc [,m])`` mclose closes an opened file. syntax: ``mclose­(fi­le_­name)`` linspace It generates a row vector of 'n' equally spaced values ranging exactly from "­x1" to "­x2". in short, vector of size n whose components are equidistant. clf It can be used to delete all children of a given graphic window, hence 'clearing it'. isoview This property is used to have isometric scales on the x, y and z axes (for exemple to make the display of the curve sin(x) versus cos(x) be a circle not an ellipse). gsort gsort performs a "­quick sort" for various native data types. By default- Sorting is performed in decreasing order 'd'. syntax: ``gsort(­inc­rea­,'g­','i')`` where, ``i`` represents increasing order & 'd' for decreasing order (default).