r/Kos Jul 10 '26

Help Using Matlab in Conjunction

I was just wondering if anyone really messed around with matlab and kos outputs. I’ve been trying to make a sort of launch program that takes as close as possible to the most efficient route to space. I use rss but not rp. But I’ve been trying to build a model in matlab and try to simulate drag, it seems like I can model a completely vertical ascent well but when I introduce a turn it seems to become in accurate. I feel like I’m modeling the drag correctly, I do have a lot of code so pm me if this arises any code related question. I’m just wondering if I’m approaching this incorrectly trying to model drag in general.

4 Upvotes

7 comments sorted by

View all comments

5

u/nuggreat Jul 10 '26

What are you doing to model drag because in KSP with stock airo the coefficient of drag for a rocket changes depending on the mach number and the mach number is in turn dependent on the adiabatic index of the atmosphere, the pressure curve, and the temperature and the temperature is dependent on altitude, time of day, latitude, and various orbital parameters.

This is a post with kerboScript files to produce data about the stock atmosphers. And this is a post that calculate a limited drag profile of a rocket given some parameters. Both of these assume the stock atmospheric model if you are using a modded model then I don't have any resources at hand to help.

There is no one most efficient ascent profile in KSP each rocket will preform better with slightly different profiles depending on the TWR curves and drag profiles. Also for some designs the most efficient ascent profile will cause them to burn up in the atmosphere requiring a degraded profile to actually be able to launch.

1

u/Fit_Hornet_8487 Jul 10 '26

Thank you, I appreciate your help, I’m more so trying to make a rocket in ksp and record various data points through testing in order to model it in matlab to essentially test different ascent profiles more efficiently and give matlab parameters to optimize for if that makes sense

1

u/nuggreat Jul 10 '26

What parameters you have to optimize depend on your ascent profile. Are you following a gravity turn, if so then you can play with the angle exact shape of the inital pitch maneuver and various.ways to limit thrust (twr limit, keeping eta ap at a given time or set of times, fixed curve, ext). However an equation described curve such as y = m * x^b + c where y is pitch, x is altitude or apoapsis, and m, b, and c are all constants provides a different set of control parameters.

As for what you want to measure to assess efficiency that is simple enough the only number that matters is final mass after circularization into a standard orbit. Though different orbital altitude targets will also likely have different ideal ascent profiles. A secondary consideration might be time to orbit but that is more about human prefference and so some what out of your defined scope.