File Exchange

image thumbnail

Galaxy model

version 2.6 (1.75 KB) by Nicolas Douillet
A function to compute and display a galaxy point cloud (spiral or elliptic), with some tunable parameters (shape, number of arms, etc...)


Updated 18 Aug 2020

GitHub view license on GitHub

Design your own galaxy ! :-)

For pedagogic / scientific diffusion purposes. Is not a rigorous astrophysical model.

F5 in galaxy_model.m or galaxy_model; in console to run the program and plot the figure.

A lot of parameters -curvature, number of arms, number of stars and many others- are available in the file header to tune the shape of the model.

Since these parameters are quite sensitive, my advice is to first test them individually -one by one- to understand their influence.

For some out of range parameter values, you may encounter this warning in Matlab console :

> Warning: Using only the real component of complex data.
> In getRealData (line 52)
> In scatter3 (line 59)
> In spiral_galaxy_model (line 115)

In this kind of case, just go back to some reference example parameter set, and do again your parameter tuning, one by one.

Questions, support, feedback : nicolas.douillet (at)

Cite As

Nicolas Douillet (2020). Galaxy model (, GitHub. Retrieved .

Comments and Ratings (0)



See release notes for this release on GitHub:


Added one parameter set example for elliptic galaxy type


Updated file name in description


Fixed colormap figure bug


Name, cover img, typo


Profile view option + typo


Model improvement with some extra parameters (distribution, Markers, colors, etc), profile view, parameter set examples, description.

MATLAB Release Compatibility
Created with R2019b
Compatible with any release
Platform Compatibility
Windows macOS Linux