Review of Scilab Command Lines
Review of Scilab Command Lines
Activity no. 1
II. Problem
1. Review of Scilab command lines.
III. Solution
Programming
Boolean - A boolean variable is %T (for "true") or %F (for "false").
These variables can be used to define matrices of booleans, with the usual
syntax. Boolean matrices can be manipulated as ordinary matrices for
elements extraction/insertion and concatenation. Note that other usual
operations ( +, *, -, ^, etc) are undefined for booleans matrices, three
special operators are defined for boolean matrices:
Bool2s - convert boolean matrix to a zero one matrix.
Break - keyword to interrupt loops
Continue - keyword to pass control to the next iteration of a loop
Find - find indices of boolean vector or matrix true elements
Intpty - set interface argument passing properties
Elementary Functions
adj2sp - converts adjacency form into sparse matrix.
and - (&) logical and
asin - sine inverse
besselh - Bessel functions of the third kind (aka Hankel functions)
besseli - Modified Bessel functions of the first kind (I sub alpha).
besselj - Bessel functions of the first kind (J sub alpha).
besselk - Modified Bessel functions of the second kind (K sub alpha).
bessely - Bessel functions of the second kind (Y sub alpha).
beta - beta function
binomial - binomial distribution probabilities
bloc2exp - block-diagram to symbolic expression
bloc2ss - block-diagram to state-space conversion
bsplin3val - 3d spline arbitrary derivative evaluation function
cos - cosine function
eval_cshep2d - bidimensional cubic shepard interpolation evaluation
interp - cubic spline evaluation function
interp1 - one_dimension interpolation function
interp2d - bicubic spline (2d) evaluation function
interp3d - 3d spline evaluation function
interpln - linear interpolation
intersect - returns the vector of common values of two vectors
intsplin - integration of experimental data by spline interpolation
inttrap - integration of experimental data by trapezoidal interpolation
log - natural logarithm
max - maximum
meshgrid - create matrices or 3-D arrays
min - minimum
modulo - symetric arithmetic remainder modulo m
pmodulo - positive arithmetic remainder modulo m
sin - sine function
solve - symbolic linear system solver
tan - tangent
vectorfind - finds in a matrix rows or columns matching a vector
Graphic library
LineSpec - to quickly customize the lines appearance in a plot
Matplot - 2D plot of a matrix using colors
Sfgrayplot - smooth 2D plot of a surface defined by a function using colors
addcolor - add new colors to the current colormap
arc_properties - description of the Arc entity properties
axes_properties - description of the axes entity properties
axis_properties - description of the axis entity properties
bar - bar histogram
barh - horizontal display of bar histogram
barhomogenize - homogenize all the bars included in the current working
axes
clf - clear or reset the current graphic figure (window) to default values
color - returns the color id of a color
copy - copy a graphics entity.
delete - delete a graphic entity and its children.
draw - draw an entity.
figure_properties - description of the graphics figure entity properties
fplot2d - 2D plot of a curve defined by a function
fplot3d - 3D plot of a surface defined by a function
fplot3d1 - 3D gray or color level plot of a surface defined by a function
getcolor - opens a dialog to show colors in the current colormap
getfont - dialog to select font
histplot - plot a histogram
legends - draw graph legend
loadplots - loads and formats saved old style plots
move - move, translate, a graphic entity and its children.
nf3d - rectangular facets to plot3d parameters
nyquist - nyquist plot
graphic - description of the graphic object editor capacities
menus - description of the graphic object editor capacities
plot - 2D plot
plot2d - 2D plot
plot3d - 3D plot of a surface
plotframe - plot a frame with scaling and grids
plzr - pole-zero plot
polarplot - Plot polar coordinates
rotate - rotation of a set of points
scaling - affine transformation of a set of points
secto3d - 3D surfaces conversion
set - set a property value of a graphic entity object or of a User Interface
object.
square - set scales for isometric plot (change the size of the window)
surf - 3D surface plot
xaxis - draw an axis
zgrid - zgrid plot
zoom_rect - zoom a selection of the current graphic figure
Programs:
1. dt=0.01;
t=-5:dt:5;
function ta=rect(t)
[m,n]=size(t);
for r=1:m
for c=1:n
if t(r,c)<-0.5 then
ta(r,c)=0; end;
if t(r,c)>=-0.5 & t(r,c)<=0.5 then
ta(r,c)=1; end;
if t(r,c)>0.5 then
ta(r,c)=0; end;
end;
end;
endfunction;
plot2d(t,rect(t));
2. dt=0.001;
t=-5:dt:5;
function ta=ramp(t);
[m,n]=size(t);
for r=1:m
for c=1:n
if t(r,c)<0 then
ta(r,c)=0; end;
if t(r,c)>=0 & t(r,c)<1 then
ta(r,c)=t(r,c); end;
if t(r,c)>=1 then
ta(r,c)=0; end;
end;
end;
endfunction;
plot2d(t,ramp(t));
3. dt=0.001;
t=-5:dt:5;
function ta=tri(t)
[m,n]=size(t);
for r=1:m
for c=1:n
if t(r,c)<-1 then
ta(r,c)=0; end;
if t(r,c)>-1 & t(r,c)<0 then
ta(r,c)=t(r,c)+1; end;
if t(r,c)>=0& t(r,c)<1 then
ta(r,c)=-t(r,c)+1; end;
if t(r,c)>=1 then
ta(r,c)=0; end;
end;
end;
endfunction;
plot2d(t,tri(t));
Results:
1.
2.
3.
IV. Comments
1. Most Scilab commands came from the root word of its function.
2. Different function signals can be done in scilab program.
3. Scilab can help in analysis of complex waveforms.