Modelling a galaxy with Simscape Multibody

Dear MATLAB Community,
I've saw an example on modelling the solar system using Simulink Simscape Multibody (link: https://se.mathworks.com/help/physmod/sm/ug/model-planet-orbit-due-to-gravity.html) in MATLAB R2019b.
However, I would like to change this simulation to simulate a galaxy instead (with e.g. 400 stars orbiting), is this possible in Simulink?
Also, when objects collide, I noticed they literally bounce off of each other, and don't "mold" and become 1, is there a property that allows them to stay intact after collision?
Thank you for your help,
Best Regards,
Arpad

Answers (1)

Hi Arpad,
> However, I would like to change this simulation to simulate a galaxy instead (with e.g. 400 stars orbiting), is this possible in Simulink?
Yes! You can copy-paste to add as many objects as your computers memory will allow.
> Also, when objects collide, I noticed they literally bounce off of each other, and don't "mold" and become 1, is there a property that allows them to stay intact after collision?
This can be done by activating Weld Joints between the objects. However, you have to know which ones might collide and put a deactivated joint between them. This might be prohibitive for so many objects.
--Steve

2 Comments

Dear Steve,
Thank you for your reply! Is there a guide as to how to attach the "Weld Joints"? So should it be placed between the objects/planets or?
I really appreciate your help!
Best regards,
Arpad
The weld joints need to be between any planets that may collide, and "Mode" needs to be set to "Provided by Input". The input signal should be 0 until the planets collide, then set it to 1.
--Steve

Sign in to comment.

Categories

Products

Release

R2019b

Asked:

on 9 Jan 2020

Commented:

on 9 Jun 2021

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!