Making curves reach axes
Show older comments
I am trying to make a plot of the power generated by a rising helium balloon in function of its hight for different balloonvolumes. The curves of the smallest 2 balloons dont go all the way down to zero on the plot (or reach the x-axis) wich makes them akwardly float. I tried to modify the y-axis range but it doesn't work.
Vb0_vec = [10 100 250 1000];
mb_vec = (20*10^-3)*(36*pi*Vb0_vec.^2).^(1/3);
lambda = 0.0173;
rhog0 = 0.169;
Cw = 0.41;
y = linspace(0, 11000, 2000);
% Plot 4: vermogen ifv de hoogte voor vershillende ballonvolumes
P_10 = Power(y, Vb0_vec(1), lambda, mb_vec(1), rhog0, Cw);
P_100 = Power(y, Vb0_vec(2), lambda, mb_vec(2), rhog0, Cw);
P_250 = Power(y, Vb0_vec(3), lambda, mb_vec(3), rhog0, Cw);
P_1000 = Power(y, Vb0_vec(4), lambda, mb_vec(4), rhog0, Cw);
figure()
semilogy(y, P_10, 'b-', 'LineWidth', 2)
hold on
semilogy(y, P_100, 'LineWidth', 2)
semilogy(y, P_250, 'r--', 'LineWidth', 2)
semilogy(y, P_1000, 'g:', 'LineWidth', 2)
hold off
ylabel("Vermogen (W)")
xlabel("Hoogte (m)")
title("Momentaan geleverd vermogen over het traject voor verschillende ballonvolumes",...
"FontSize", 16)
legend("10 m³", "100 m³", "250 m³", "1000 m³", "Location", "southeast")
% volgende code zorgt dat de curves mooi doorlopen tot aan de assen
ymin_10 = min(P_10);
ymin_100 = min(P_100);
ymin = max(ymin_10, ymin_100);
ylim = [ymin, 10^5];
xlim([0 11000])
This is the code for the function Power, LoadConstants loads all the necessary parameters/constants:
unction [P] = Power(y, Vb0, lambda, mb, rhog0, Cw)
% vaste parameters
LoadConstants
% tussenberekeningen
% krachten
Fa = rhol0*Vb0*g;
Fzk = lambda*y*g;
Fzb = (rhog0*Vb0+mb)*g;
% hoogteafhankelijke parameters
Vb = Vb0*(1-y*L/Tl0).^(1-(g*Ml/(R*L)));
rhol = rhol0*(1-y*L/Tl0).^((g*Ml/(R*L))-1);
rb = ((3*Vb)/(4*pi)).^(1/3);
Ab = pi*rb.^2;
% vermogen
P = (2/3)*sqrt(2/3)*sqrt(((Fa-Fzb-Fzk).^3)./(Ab*Cw.*rhol));
end
Output of the plot:

Thank you
Accepted Answer
More Answers (0)
Categories
Find more on Vibration Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!