How do i make this function write to the ode
Afficher commentaires plus anciens
Hey Fellas
I have a issue with a function where i want to share the thrust and fuelin with a ode45. when i run the program it says
"Unrecognized function or variable 'thrust'.
Error in fdsafafdafda (line 33)
thrust_stage1=thrust*1000;"
isnt the function sharing the thrust via the outputargument? how do i make it work.
function tryss
menu('how much fuel and thrust do you want? ', 'Falcon 9', ' too much fuel ','Too little fuel', ' too little thrust', 'custom');
function [thrust,fuelin]=choice(menu)
if menu ==1
%standard Falcon 9
thrust=7607;
fuelin=423;
elseif menu ==2
thrust=7607;
fuelin=1000;
elseif menu ==3
thrust= 7607;
fuelin=40;
elseif menu ==4
thrust=1600;
fuelin=423;
elseif menu==5
thrust=input('kN thrust? ');
fuelin=input('tons of fuel? ');
end
end
thrust_stage1=thrust*1000;
fuel=fuelin*1000;
thrust_stage2=934000; %standard
tid=[0.1 1500];
SB = [0,0,0];
T=(1:1500);
opt = odeset('event', @analyse);
[t,y] = ode45(@(t,y) stage1(t,y,T,thrust_stage1, thrust_stage2,fuel),tid,SB,opt);
end
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!