mirror of
https://gitlab.com/lander-team/plots.git
synced 2025-07-23 06:41:24 +00:00
CDR plots
This commit is contained in:
43
ThrustDef.jl
Normal file
43
ThrustDef.jl
Normal file
@@ -0,0 +1,43 @@
|
||||
using Plots
|
||||
using Unitful
|
||||
using UnitfulRecipes
|
||||
using NumericalIntegration
|
||||
|
||||
theme(:juno)
|
||||
|
||||
rate = 180u"°/s"
|
||||
|
||||
max_deflection = 15u"°"
|
||||
|
||||
|
||||
dt = 0.001u"s"
|
||||
time = 0u"s":dt:2u"s"
|
||||
|
||||
|
||||
angle = [(t * rate) % max_deflection for t in time]
|
||||
|
||||
v = cos.(angle) .* u"N"
|
||||
h = sin.(angle) .* u"N"
|
||||
|
||||
horizontal_impulse = let
|
||||
vimp = integrate(time, v)
|
||||
himp = integrate(time, h)
|
||||
|
||||
round(himp / (vimp + himp) * 100) |> Int
|
||||
|
||||
end
|
||||
|
||||
let
|
||||
plot(time, v, label = "Vertical")
|
||||
plot!(time, h, label = "Horizontal")
|
||||
yticks!(0:0.25:1, string.(0:25:100) .* "%")
|
||||
ylabel!("Percent of Thrust")
|
||||
xticks!(0:0.5:2, string.(0:0.5:2) .* "s")
|
||||
xlabel!("Time")
|
||||
title!(
|
||||
"Max Deflection: $(max_deflection)\n" *
|
||||
"Vertical Impulse: $(100-horizontal_impulse)% | Horizontal Impulse: $(horizontal_impulse)%",
|
||||
)
|
||||
end
|
||||
|
||||
savefig("ThrustDef.png")
|
Reference in New Issue
Block a user