Hi Guys i need help with plotting

1 次查看(过去 30 天)
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 个评论
Cris LaPierre
Cris LaPierre 2025-2-19
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.

请先登录,再进行评论。

回答(1 个)

Divyam
Divyam 2025-2-26
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

类别

Help CenterFile Exchange 中查找有关 View and Analyze Simulation Results 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by