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)

Answers (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 Comments

Suchita Gupta
Suchita Gupta on 21 Sep 2022
Moved: Walter Roberson on 21 Sep 2022
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')

Sign in to comment.

Categories

Tags

Asked:

on 21 Sep 2022

Commented:

on 21 Sep 2022

Community Treasure Hunt

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

Start Hunting!