Scilab & GNU Octave — Open-Source Alternatives
Scilab & GNU Octave — Open-Source Alternatives
Scilab is a free, open-source numerical computing platform originally developed by INRIA (France). It offers a MATLAB-like syntax with its own extensions for control systems, signal processing, and optimization.
GNU Octave is a free, open-source language designed to be largely compatible with MATLAB syntax. Most MATLAB scripts run unchanged in Octave.
| Feature | MATLAB | Scilab | Octave |
|---|---|---|---|
| License | Commercial | Free (GPL-compatible) | Free (GPL) |
| Syntax | MATLAB syntax | Similar but has differences | Nearly identical to MATLAB |
| Indexing | 1-based | 1-based | 1-based |
| Boolean | true/false | %T/%F | true/false |
| End keyword | end | end | end or endfor |
| Plotting engine | Built-in | Built-in (different API) | gnuplot or Qt |
- Vectors:
v = [1 2 3 4 5];— same as MATLAB - Matrices:
A = [1 2; 3 4]; - Colon operator:
t = 0:0.1:10; - Solving $Ax = b$:
x = A \ b;orx = inv(A) * b; - Plotting:
plot(x, y); xtitle('Title','x','y'); - Special constants:
%pi,%e,%i(imaginary unit),%T/%F(booleans)
- Compatibility: Most MATLAB
.mfiles run directly. - String quoting: Supports both
'text'and"text"(MATLAB only uses single quotes for character arrays). - Auto-broadcasting: Octave automatically broadcasts array dimensions; MATLAB requires
bsxfunor explicit expansion. - Packages:
pkg install -forge package_nameto add toolbox equivalents from Octave Forge.
- MATLAB — industry standard; required in many courses; largest toolbox ecosystem (Simulink, Signal Processing, etc.).
- GNU Octave — best free substitute for MATLAB homework/scripts; high syntax compatibility.
- Scilab — Xcos block diagrams (like Simulink); good for control engineering; active European community.
Plot $y = e^{-0.3t}\sin(2\pi t)$ for $0 \le t \le 10$ in Scilab.
t = linspace(0, 10, 500);
y = exp(-0.3*t) .* sin(2*%pi*t);
plot(t, y); xtitle('Damped Oscillation','t (s)','y');
Variables: t — time vector (500 points); y — amplitude at each time; %pi — Scilab's $\pi$ constant.
Find eigenvalues of $A = \begin{bmatrix}4&1\\2&3\end{bmatrix}$ in Octave.
A = [4 1; 2 3];
[V, D] = eig(A);
Result: $D = \begin{bmatrix}2&0\\0&5\end{bmatrix}$, so $\lambda_1 = 2,\; \lambda_2 = 5$.
Variables: V — matrix of eigenvectors; D — diagonal matrix of eigenvalues.
Create a contour plot of $f(x,y) = x^2 + y^2$ over $[-3,3] \times [-3,3]$.
x = linspace(-3,3,100); y = x;
[X, Y] = meshgrid(x, y);
Z = X.^2 + Y.^2;
contour(x, y, Z, 10);
Variables: X, Y — 2-D mesh grids; Z — function values; 10 — number of contour levels.
Practice Problems
A \ b work in both Scilab and Octave?.m files directly in Octave?Show Answer Key
1. MATLAB is commercial/paid; Scilab is free and open-source
2. GNU Octave
3. %pi
4. xtitle('Title','x-label','y-label')
5. pkg install -forge package_name
6. True
7. Xcos
8. Yes
9. %T (true) and %F (false)
10. Most, but not all (toolbox-specific functions may differ)
11. Automatically expands arrays of different dimensions for element-wise operations
12. It is completely free — no license cost