The GNU Octave is a software package for doing scientific numeric calculations. Octave is mostly compatible with Matlab and is so a free alternative. On this page I show off some of the Octave scripts I've written.

All these scripts and more can be downloaded as a single self-containing package - all the scripts to produce all the imagery here are also there. Use these scripts as examples to learn Octave/Matlab. If you use these scripts in your work then you should give me visible credit in any published document, software or product. Download ov-0.4.zip.

At the moment (29 July 2008) you need the latest stable Octave to run these scripts properly, the 3.0.1.

If you are using vanilla octave on Linux at its current incarnation you might have to install a few extra packages from the octave-forge. Most notably 'specfun' and 'OdePkg'. You might already have them so look into this once you get errors of undefined functions like 'ellipke' and 'ode45' in these scripts.

circle3d.m A simple 3D circle coordinate generation script. Takes a 3D position and normal vector, returns coordinates that can be used in plot3().
camera3dn.m I had a problem in Octave that I could not properly project lines onto a pre-drawn sphere in octave. Maybe there is a solution out there but I was not able to find it. So I worked out my own - calculate the plane intersecting the sphere perpendicular to the view angle. Anything behind that plane can be left undrawn. We use the azimuth and the elevation returned by the view() function.
These functions provide the off-axis magnetic field of a loop of current. The calculation uses an analytic solution that makes use of elliptic integrals. If you need a reference try chapter 20 from the Dolan's "Fusion Research" book. The analytic solution is a bit unstable for the radial component very near the axis of a loop and so linear interpolation is used there instead. The functions are mostly vectorized so should be quite efficient.
polywell_bfield.m This function combines 6 loops of current to form the magnetic coil configuration for the cube polywell nuclear fusion reactor.
ball.mat A sample script using most of these functions to visualize a theoretical wiffleball configuration in the polywell nuclear fusion reactor.
line_bfield3d.m Mangetic field of a finite line segment. Fully vectorized for multiple lines and points. On this picture you can see three line segments, two point out of the page and the middle one into the page.


Copyright © 2001-2017 Indrek Mandre