Hi Guys i need help with plotting
1 view (last 30 days)
Show older comments
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')
% 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 Comment
Cris LaPierre
on 19 Feb 2025
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.
Answers (1)
Divyam
on 26 Feb 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
0 Comments
See Also
Categories
Find more on View and Analyze Simulation Results 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!