How can i combine 5 curves in one figure?
2 ビュー (過去 30 日間)
古いコメントを表示
Hello!
I have 5 figures, I want to combine the curves in such a way that only one curve can be seen .
this is the code
Xu=linspace(0,12,60);
Yu=linspace(0,10,60);
figure()
p1=plot(Xu,Yu)
xlabel('temps(min)')
ylabel('X(km)')
p1.LineWidth = 1.5;
grid on
%----------
Xu=linspace(12,24,60);
Yu=linspace(10,0,60);
figure()
p1=plot(Xu,Yu)
xlabel('temps(min)')
ylabel('X(km)')
p1.LineWidth = 1.5;
grid on
%-------------------
Xu=linspace(24,36,60);
Yu=linspace(0,10,60);
figure()
p1=plot(Xu,Yu)
xlabel('temps(min)')
ylabel('X(km)')
p1.LineWidth = 1.5;
grid on
%----------------
Xu=linspace(36,48,60);
Yu=linspace(10,0,60);
figure()
p1=plot(Xu,Yu)
xlabel('temps(min)')
ylabel('X(km)')
p1.LineWidth = 1.5;
grid on
%-------------
Xu=linspace(48,60,60);
Yu=linspace(0,10,60);
figure()
p1=plot(Xu,Yu)
xlabel('temps(min)')
ylabel('X(km)')
p1.LineWidth = 1.5;
grid on
0 件のコメント
採用された回答
Sam Chak
2022 年 9 月 6 日
I didn't clean up the code. But more or less, the hold is used. You can also set the LineColor so that it appears as a piecewise function.
Xu=linspace(0,12,60);
Yu=linspace(0,10,60);
plot(Xu,Yu, 'LineWidth', 1.5), hold on
% xlabel('temps(min)')
% ylabel('X(km)')
% p1.LineWidth = 1.5;
% grid on
%----------
Xu=linspace(12,24,60);
Yu=linspace(10,0,60);
plot(Xu,Yu, 'LineWidth', 1.5), hold on
% xlabel('temps(min)')
% ylabel('X(km)')
% p1.LineWidth = 1.5;
% grid on
%-------------------
Xu=linspace(24,36,60);
Yu=linspace(0,10,60);
plot(Xu,Yu, 'LineWidth', 1.5), hold on
% xlabel('temps(min)')
% ylabel('X(km)')
% p1.LineWidth = 1.5;
% grid on
%----------------
Xu=linspace(36,48,60);
Yu=linspace(10,0,60);
plot(Xu,Yu, 'LineWidth', 1.5), hold on
% xlabel('temps(min)')
% ylabel('X(km)')
% p1.LineWidth = 1.5;
% grid on
%-------------
Xu=linspace(48,60,60);
Yu=linspace(0,10,60);
plot(Xu,Yu, 'LineWidth', 1.5), hold off
xlabel('temps(min)')
ylabel('X(km)')
grid on
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Interactive Control and Callbacks についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!