This is supplementary MATLAB code for the article "Spectral Decomposition for Topology Optimization using graded-microstructures" The code must be run using gMTO.m script section-wise. 1. Run the first two sections (clear previous variables and set path). 2. Set the microstructure and optimization parameters in section 3. 3. Run section 3 (user-defined parameter) and section 4 (default parameters). 4. If the Spectral Decomposition method is to be used run section 5 and section 6 5. Otherwise for direct regression method run section 7 and 8. 6. If the section 5 and 7, both have been executed for a microstructure, an R^2 comparison is possible using section 9.