Top3d is a free MATLAB® program that solves topology optimization problem in 3D. The program is:

  • compact without sacrificing readability,
  • easy-to-use without losing complexity, and
  • multi-functional without programming immensity.


Save the program top3d.m (8 kB) and start MATLAB in the same directory. The program can be promoted by line:

top3d(30, 10, 2, 0.5, 3.0, 1.2)

A quick start guide is available here.
More step-by-step tutorials are also available here.


The program has been exhaustively explained in the journal publication:

K. Liu and A. Tovar, “An efficient 3D topology optimization code written in Matlab”, Struct Multidisc Optim, 50(6): 1175-1196, 2014, doi:10.1007/s00158-014-1107-x

Errata can be found here.


Take Top3d results for 3D printing using Top3dSTL!

  • Top3dSTL_v3.m (10 kB) is a simple STL writer for Top3d topologies. Options such as binary or ascii format, cubic or isosurfce reresentation are available.

top3dSTL(‘MyTop3d.STL’, xPhys, ‘Format’, ‘ascii’)