Hi Guys i need help with plotting

2 visualizaciones (últimos 30 días)
Kilian Friedrich Wilhelm
Kilian Friedrich Wilhelm el 19 de Feb. de 2025
Respondida: Divyam el 26 de Feb. de 2025
Im Kinda new to Matlab and i want to Plot these graphs, but some of them should end before the other ones. so can anyone help me or show me how im going to end these graphs before the other ones.
The ones i want to end early are (Whole Take off and Whole landing) Takeoff i want to end at around y-achse 2 and landing at 2.5 y-achse
figure()
grid on
hold on
% Cruise
% Clean
plot(c_w_1_b, c_a_vect, '-', 'Color', 'b')
Unrecognized function or variable 'c_w_1_b'.
% Long Range
plot(c_w_2_b, c_a_vect, '--', 'Color', 'b')
epsilon_cr_opt = max(c_a_vect./c_w_2_b);
% High Speed
plot(c_w_3_b, c_a_vect, '-.', 'Color', 'b')
% Take-Off
% Gear
plot(c_w_4_b, c_a_vect, '--', 'Color', 'g')
[epsilon_to_opt , mValto] = max(c_a_vect./c_w_4_b);
c_a_to_opt = mValto * 0.0001;
% W/O Gear
plot(c_w_5_b, c_a_vect, '-', 'Color', 'g')
% Landing
% Gear
plot(c_w_6_b, c_a_vect, '--', 'Color', 'r')
[epsilon_ldg_opt , mValldg] = max(c_a_vect./c_w_6_b);
c_a_ldg_opt = mValldg * 0.0001;
% W/O Gear
plot(c_w_7_b, c_a_vect, '-', 'Color', 'r')
lgd = legend('Clean Cruise', 'Long Range Cruise', 'High Speed Cruise', 'Take-Off w/ Gear', 'Take-Off w/o Gear', 'Landing w/ Gear', 'Landing w/o Gear', 'Location', 'southeast');
lgd.FontSize = 15;
xlabel('Widerstandsbeiwert c_{W} [-]', 'FontSize', 13);
ylabel('Auftriebsbeiwert c_{A} [-]', 'FontSize', 13);
title('Widerstandspolare', 'FontSize', 15);
thx for the help sincerly Kilian
  1 comentario
Cris LaPierre
Cris LaPierre el 19 de Feb. de 2025
For help plotting, consider going through Ch 9 of MATLAB Onramp.
Without your data, it is difficult to know how to help. There is nothing wrong with your syntax. Consider saving your variables to a mat file and attaching that to your post using teh paperclip icon.

Iniciar sesión para comentar.

Respuestas (1)

Divyam
Divyam el 26 de Feb. de 2025
To ensure that while plotting some lines end earlier than others you can specify the data you pass to the 'plot' function. Here is an example:
% Assuming that you wish to end the plots as soon as they cross a y = 1
% Find the index where the y values exceed 1
idx = find(y_values > 1, 1);
plot(x_values(1:idx), y_values(1:idx), <Properties of the plot>);
For more information regarding the 'find' function, refer to this documentation: https://www.mathworks.com/help/matlab/ref/find.html

Categorías

Más información sobre View and Analyze Simulation Results en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by