Plot of a function
显示 更早的评论
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 ;
end
if t>tcomb1 & t<tcomb2
acel=empuje(h,t)./(Wmisil2-t.*gasto2) - ...
resistencia_aerodinamica(V,h,alfa,delta,t)./(Wmisil2-t.*gasto2)...
-g ;
end
if 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
采纳的回答
更多回答(1 个)
Walter Roberson
2013-11-10
Your t is a vector.
An evaluated expression is true when the result is nonempty and contains all nonzero elements (logical or real numeric). Otherwise, the expression is false.
类别
在 帮助中心 和 File Exchange 中查找有关 Image Arithmetic 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!