Simple Examples of Plotting with Octave
These examples are for Octave older than 3.0.
- The Sombrero
This figure is created with the following octave code
sombrero(32) gset nokey gset contour gset grid replot
- The Lorentz Strange Attractor
This figure is created with the following octave code
function y = lorenz (x, t)
y = [10 * (x(2) - x(1));
x(1) * (28 - x(3));
x(1) * x(2) - 8/3 * x(3)];
endfunction
x = lsode ("lorenz", [3; 15; 1], (0:0.01:25)');
gset parametric
gsplot x
gset noxtics
gset noytics
gset noztics
gset noborder
gset nokey
- Magnetic Field / Force
This example shows the field lines around a bar magnet. It is rather colorful since I wasn't sure how to make them all the same color.
function magfield clearplot axis( [-1 1 -1 1] ) hold on gset nokey N = [ 0, 0.2 ]; S = [ 0, -0.2 ]; gplot( [ S ; N ] ); for i=1:100 E = [ (2*rand-1) (2*rand-1) ]; F = ( E - N ) / norm( E- N ) ^ 2 \ + ( S - E ) / norm( S - E ) ^ 2; F = unit(F) * 0.03; gplot( [ E-F; E+F ] ); end endfunction function u = unit( V ) u = V / norm( V ); endfunction
SEAlternateMagFieldExample using a different plot technique (all the same color, possibly faster, but not interactively drawn).
CategoryPlotting

