Why do I get same plotting results for different inputs?
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
Recently I am trying to solve a system of equations with ode15s. The goal is to calculate the Ascent trajectory of a Rocket with a control variable alpha, which is the angle between the velocity vector v and the thrust vector, so that by changing alpha manually I should change the flight direction.
in a first run I assume alpha to be konstant and I experimented a little bit with the value (so for example alpha=-2*... and in the next run alpha= +10*...). In a next step I assumed alpha to be linear and in a last step I assumed it to be quadratic:
I am using ode15s to solve the equations, because my code needs to include the algebraic variable t.
I plotted the results over t and I receive the exact same plots for every single run, regardless of alpha being konstant linear or quadratic.
How is that possible? I am thankful for every help I can get.
%earth parameters
re=6378e3;%[m]
g0=9.81;
%vehicleparameters
m0=68e3;%initial mass
Isp=390;
ceff=Isp*g0;%effektive Austrittsgeschwindigkeit
thrust=933910;
propflow=thrust/ceff;
tburn=m0/propflow;%Annahme:Rakete besteht nur aus Treibstoff
%pitchover values
hpo=re+130;%pitchover altitude
ghpo=g0*((re/(hpo))^2);%Gravitationsbeschleunigung beim Pitchover
syms x
f=(-ghpo/2)*(((m0-x)/propflow)^2)+(ceff/propflow)*(x*log(x/m0)+m0-x)==130;
mpo=double(vpasolve(f,x));
vpo=-ghpo*((m0-mpo)/propflow)-ceff*log(mpo/m0);
%Integation time
tRange=0:tburn/30:tburn;
y0=89.85*pi/180;%Ausrichtung der Rakete
v0=vpo;
h0=hpo;
x0=0;
w0=0;
Y0=[y0;v0;h0;x0;m0;w0];
%Solve System of Equations
[tSol,YSol]=ode15s(@APalpha,tRange,Y0);
function dYdt= APalpha(t,Y)
format short
y=Y(1);
v=Y(2);
h=Y(3);
xd=Y(4);
m=Y(5);
w=Y(6);
%earth parameters
re=6378e3;%Erdradius[m]
g0=9.81;%Erdbeschleunigung[m/s^2]
rho0=1.225;%Luftdichte[kg/m^3]
sh=7500;%skalare Höhe[m]
%vehicle parameters
m0=68e3;%Startmasse[kg]
thrust=933910;%Schub[N]
diameter=5;%Durchmesser der Rakete[m]
R=diameter/2;
Cdrag=0.5; %Strömungswiderstandskoeffizient
Isp=390;%spezifischer Impuls[s]
H=20;%Height of the Rocket[m]
area=pi*(R^2);%Raketenfläche[m^2]
Adrag=Cdrag*area;%angeströmte Fläche[m^2]
ceff=Isp*g0;%[m/s]
propflow=thrust/ceff;% Treibstoffmassenstrom[kg/s]
V0=pi*R^2*H;%initial Volume of the rocket[m^3]
rhop=m0/V0;%Dichte Treibstoff[kg/m^3]=const.
rs=10;%Hebelarm zum Schwerpunkt[m]
tburn=m0/propflow;%Brenndauer
rt=(2.5/tburn)*t;%Innenradius der Treibstoffsäule[m]
Ix=(pi*rhop*H/12)*(3*(R^4-rt^4)+H^2*(R^2-rt^2));%Trägheitsmoment um x-Achse[kg*m^2]
%Thrust vector control variable
alpha=(0.01*pi/180);%[rad]...assumed to be konstant/linear/quadratic[rad]
%Run 2: alpha= (0.01*pi/180)*t+v0
%Run 3: alpha= 0,5*(0.01*pi/180)*(t^2)+v0*t+x0
%functions
gh=g0*((re/h)^2);%Gravitationsbeschleunigung abh. von h
rhoh=rho0*exp(-h/sh);%Luftdichte abh. von h
%EoM
dydt=((thrust*sin(alpha))/(m*v))-(v*cos(y)/h)-(gh*cos(y))/v;
dvdt=((thrust*cos(alpha))/m)-gh*sin(y)-((rhoh*Adrag*(v^2))/(2*m))*cos(alpha);
dhdt=v*sin(y);
dxddt=(re/h)*v*cos(y);
dmdt=-propflow;
dwdt=(1/Ix)*thrust*sin(alpha)*rs;
dYdt=[dydt;dvdt;dhdt;dxddt;dmdt;dwdt];
end
0 Commenti
Risposte (0)
Vedere anche
Categorie
Scopri di più su Ordinary Differential Equations in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!