Made a graphical demonstration for rocket flying, considering non-constant mass and air friction, turned out to look pretty cool
For such tasks involving non-constant mass I will be using the mesherskiy equation
"F.." means external forces, such as air friction and gravitation pull
Our rocket will have 2 phases:
- With fuel, meaning differing mass, drag from the fuel exhaustion
- Without fuel, constant mass, basically only air friction
After all those preparations we can finally make out final equations
After expanding it into a 3 equation system it turnes out to be non-linear differential equations, which i am not going to solve analytically However we can try them out with some test data, to later reffer to this as an expected result Note: I will be doing x/y reffering to horizontal/vertical plane, however in the code x\y is horizontal and z in vertical
PART 1
PART 2
Im using this input to plot my data manually: plot_me("red", a =math.pi/4 , b = math.pi/2.38,fcons =700,fsp = 23000 , v =10)
it has a very horizontal trajectory, much like a real rocket
x1[t]
v1x[t]
x2[t]
v2x[t]
z1[t]
vz1[t]
z2[t]
vz2[t]
Compairing theory and my data, it seems as it is quite similar, which concludes as a success
I will include some actual plots, which my code can perform:
Note: after a closer look at the code, you could see that wind is indeed in the equation, HOWEVER, it shows wierd results, so it is better left at 0
TODO:
-Make dynamic graphs, add easy support for x/y/z[t] as shown above (were done in a janky way)
-Fix the wind
HUGE THANKS TO Chelovechecheggg#5451 for helping