20 views (last 30 days)

Show older comments

I have a script that is running, but the exponential plot is not acting correctly. As the x axis increases, the y axis should as well and it seems like it is doing the oppoiste of that. I have attached the equation that is needed, in the 'ideal_rocket_equation' attachment. Does anyone know how I can fix the plot

%% Coursework Number 1:

% Basing on the "Ideal Rocket Flight Performance" theory compute and show

% through suitable curves the optimal (maximum) total payload ratio

% lamda_tot of a multisage rocket with identical stages (c_i = c and k_si =

% k_s) as a function of the number of stages N.

% delta_V/c equal to 0.5, 1.0, 2.0, 3.0, and 4.0

%k_s equal to 0.1

% For N = 1

ks_1 = 0.1;

%x = linspace(0,5.0);

x = [ 0.5, 1.0, 2.0, 3.0, 4.0];

delta_V = x;

line_color = ['b' 'g' 'y' 'c' 'm'];

stages = cell(1, length(line_color));

%n = 1:5;

for i = 1: length(line_color);

stages{i} = sprintf('Stage %d' ,i);

hold on

%get new values

lamda_totmax = ((exp(-delta_V./i) - ks_1)/(1-ks_1)).^i

%lamda_totmax = ((exp(-delta_V./i)- ks_1)/(1 - ks_1)).^i;

semilogy ( x, lamda_totmax, '-', 'Color', line_color(i), 'LineWidth', 2)

end

title (' Total payload ratio as a function of demensionless ideal velocity and Number of stages', 'FontSize', 16)

ylabel ( 'Payload Ratio (lamda_tot)')

xlabel ( 'Dimensionless Ideal Velocity (delta_V/Isp*g_0')

legend( stages, 'Location', 'southwest')

the cyclist
on 16 May 2021 at 21:35

Edited: the cyclist
on 16 May 2021 at 21:36

The plot behavior looks correct to me, according to the equation.

If delta_V == 0, then lambda == 1. (You don't calculate/plot this point, but that is the result you get.)

In the limit that delta_V gets large, lambda gets smaller, and goes to

ks_1 = 0.1;

-ks_1 / (1 - ks_1) % when N == 1

This seems to be what your plot does. So, I don't see a problem. But maybe I am not understanding something.

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

Start Hunting!