not able to plot

close all
clear all
clc
d = 0.1; % Diameter of the rocket (m)
A = pi*(d/2)^2; % Area of the rocket (m^2)
Cd = 0.7; % Drag coefficient
Rho = 1; % Air density (kg/m^3)
g = 9.81; % Acceleration due to gravity (m/s^2)
Isp = 250; % Specific impulse of motor and propellant (s)
Ve = Isp*g; % Exhaust velocity (m/s)
m0 = 100; % Initial mass (kg)
me = 25; % Empty mass (kg)
mp = me; % Propellant mass (kg)
mf = m0-me; % Final mass (kg)
E = mp/(mp+m0); % Propellant mass fraction
MR = 1-E % Mass ratio
MR = 0.8000
l = log(mf/me)
l = 1.0986
C = Isp*g; % Effective exhaust velocity
u = Isp*g*l % Vehicle velocity
u = 2.6943e+03
D = (Rho^2)*(u^2)*A*Cd/2 % Drag force
D = 1.9956e+04
t = 0 % t = t0 = 0
t = 0
%
tp = 9; % Burn time
for i = 1:141
tp = tp + 1;
F = Isp*m0*g/tp;
a = (C*E/tp)/(1-E*(t/tp))-g-(Cd*Rho*(u^2)*A/m0)/(1-E*(t/tp));
hbo = g*Isp*tp*(mf*log(mf/m0)/(m0-mf)+1)-g*(tp^2)/2;
end
plot (hbo,tp)
plot (a,tp)

回答(1 个)

d = 0.1; % Diameter of the rocket (m)
A = pi*(d/2)^2; % Area of the rocket (m^2)
Cd = 0.7; % Drag coefficient
Rho = 1; % Air density (kg/m^3)
g = 9.81; % Acceleration due to gravity (m/s^2)
Isp = 250; % Specific impulse of motor and propellant (s)
Ve = Isp*g; % Exhaust velocity (m/s)
m0 = 100; % Initial mass (kg)
me = 25; % Empty mass (kg)
mp = me; % Propellant mass (kg)
mf = m0-me; % Final mass (kg)
E = mp/(mp+m0); % Propellant mass fraction
MR = 1-E % Mass ratio
MR = 0.8000
l = log(mf/me)
l = 1.0986
C = Isp*g; % Effective exhaust velocity
u = Isp*g*l % Vehicle velocity
u = 2.6943e+03
D = (Rho^2)*(u^2)*A*Cd/2 % Drag force
D = 1.9956e+04
t = 0 % t = t0 = 0
t = 0
%
tp = 9; % Burn time
for i = 1:141
tp = tp + 1;
tps(i) = tp;
F = Isp*m0*g/tp;
a(i) = (C*E/tp)/(1-E*(t/tp))-g-(Cd*Rho*(u^2)*A/m0)/(1-E*(t/tp));
hbo(i) = g*Isp*tp*(mf*log(mf/m0)/(m0-mf)+1)-g*(tp^2)/2;
end
plot (hbo,tps)
plot (a,tps)
Question: why are you using the dependent variable as the x axes, and the independent variable as the y axes?

2 个评论

Suchita Gupta
Suchita Gupta 2022-9-21
移动:Walter Roberson 2022-9-21
hi, thankyou for helping. because im working in upward direction and wanted to keep the confusion away
You might want to use
set(gca, 'YDir', 'reverse')

请先登录,再进行评论。

类别

帮助中心File Exchange 中查找有关 Solar 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by