Initial commit

Quick port of Matlab code to Julia.  Not complete or tested.