Hi Guys i need help with plotting

조회 수: 1 (최근 30일)
Kilian Friedrich Wilhelm
Kilian Friedrich Wilhelm 2025년 2월 19일
답변: Divyam 2025년 2월 26일
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