| |
Various bits of code that may be useful to people:
- AutoNetKit (ANK)
-
Matlab (most of this is also hosted on Matlab Central)
- crosshatch_poly.m lets
you do lines to fill a convex polygon (rather than filling
the polygon with a flat color using the Matlab
fill.m function. For instance see the following
picture

which was generated using crosshatch_poly_test.m.
- plot_feasible.m is a
simple bit of code for visualizing 2D linear programming
problems. Its primarily of use for teaching Linear
Algebra. It generates pictures of the form of

which was generated using plot_feasible_test.m,
though there are many options that can be used to alter the
output. Note it uses the optimization toolbox, though this
can probably be removed in the future.
- ipf.m does
Iterative Proportional Fitting (IPF). There are a
couple of ways to use IPF, but in this case the aim is to
find a matrix close to the input T that satisfies contraints
on its row sums and column sums (its marginals). In
particular we aim to find S with row sums equal to R, and
column sums equal to C. To see how to use it have a look at
ipf_test.m. More
information can be found at Wikipedia
or various other places on the web.
There is a second version of this code used in our traffic
matrix work, which is designed to allow one to find a matrix
S that satisfies an arbitrary set of linear constraints y=Ax
on a vectorized version x of the matrix T. Its not quite in a
nice form to hand out, but it you need it ask me.
- gaussian_mixture_model.m
does simple 1D Gaussian Mixture Model estimation using the EM
algorithm. It uses a couple of little functions for
estimating Gaussian distributions, so best to grab the zip file. The
result is that we can break a multimodal distribution such as
displayed below into a random mixture of Gaussians.

- randp.m generates
Pareto random variables (of type I). The Pareto distribution
is a classic heavy-tailed or power-law distribution. See
"Statistical Distributions", Evans, Hastings and Peacock,
Wiley, 1993 or my
distributions page or Wikipedia
for more information. For an example see the following
generated using randp_test.m

- rand_gamma.m
generates Gamma random variables -- see "Statistical
Distributions", Evans, Hastings and Peacock, Wiley, 1993 or
my
distributions page or Wikipedia
for more information. For an example see the following
generated using rand_gamma_test.m. Of
course Matlab's stats toolbox has gamrnd which also does
this, but not everyone has the stats toolbox.
- Conversion routines to take a surface (a function z of
(x,y) or (theta,r)) and convert this into a solid; much
as meshz does, but a little more useful for outputting
as an STL for frabrication in a 3D printer. There are
two cases, one in Cartesian co-ordinates, and the other
in polar co-ordinates. Plus two sets of examples to show
how they are used.
If you want to print out the solids in STL format, then
use surf2stl.m
by Bill McDonald, which can be had from Matlab
central. Examples of printing to STL are included in the
examples above.

- Reuleaux triangle code: A Reuleaux
triangle is a shape of constant width. That means it can
be used as a roller (but not a wheel) as the animation
shows. It's not actually a triangle, but its based on an
equilateral triangle. It's actually one of many such shapes
and the code here provides some matlab
functions for creating these shapes, and manipulating them.
One of the trickiest things to do with such a triangle
is that by rotating it around a non-fixed center, one
can carve an approximate square, making a drill bit to
drill
a square hole (or nearly square) possible. The
second animation shows this in action.
There's more info in the zip
file, along with examples of what you can do,
including the animations.


A more recent one showing a square drill animation based
on a right-angled isoceles triangle. It shows that a
point on the new rotor follows a square path
exactly. Code to come.

- Some useful bits of networking code: to come
- Traffic matrix generation: to come
- IGP weight generation: to come
- Perl
- Traffic decomposition code. to come
Matthew Roughan

Last modified: Wed Apr 27 14:34:00 2011
|