I´ve created a script that calculates the speed and altitude of a rocket vertically lauched and i don´t know how to plot the aceleration during the flight. This is one of the functions that I want and I use it to create the movement equation
function acel=aceleracion(V,h,t)alfa=0; delta=0; if t>=0 & t<=tcomb1 acel=empuje(h,t)./(Wmisil-t.*gasto1) - ... resistencia_aerodinamica(V,h,alfa,delta,t)./(Wmisil-t.*gasto1)... -g ; endif t>tcomb1 & t<tcomb2 acel=empuje(h,t)./(Wmisil2-t.*gasto2) - ... resistencia_aerodinamica(V,h,alfa,delta,t)./(Wmisil2-t.*gasto2)... -g ;endif t>=tcomb2 acel=empuje(h,t)./(W3) - ... resistencia_aerodinamica(V,h,alfa,delta,t)./(W3)... -g ;end end
whit the main script I have acomplished the values of "V" (velocity) and "h" (altitude) and also a vector "tiempo" . The problem appears when I try to plot the aceleration like this
figure(3);plot(tiempo, aceleracion(altura(:,2),altura(:,1),tiempo),'-b', 'LineWidth',1) xlabel('t [s]', 'FontSize',11); ylabel('a [ m / s^2 ]', 'FontSize',11); axis([0,tfin(end),-2*9.8,2*9.8]);
where "altura" is a vector with the solutio.ns for V and h. Can you see what is wrong? thanks
Best Answer