필터 지우기
필터 지우기

problem with displaying multiple plots in one Figure

조회 수: 2 (최근 30일)
Alex
Alex 2016년 9월 27일
댓글: Alex 2016년 9월 27일
Hi all, im trying to plot data of 4 (1×1 double Timeserie) vectors i use the code below
c=title('Einfluss der Geschwindigkeit auf den Energieverbrauch ');
b=xlabel('Zeit in [ms]');
a=ylabel('Energieverbrauch des Hauptantriebs in [KW]');
set(a,'FontSize',15)
set(b,'FontSize',15)
set(c,'FontSize',15)
set(gca,'FontSize',14);
axis([0 1030 50 63])
plot(E_Real_Hauptantrieb_130.time,E_Real_Hauptantrieb_130.Data,'-ob');
grid on;
hold on;
plot(E_Real_Hauptantrieb_100.time,E_Real_Hauptantrieb_100.time,'-og');
grid on;
hold on;
plot(E_Real_Hauptantrieb_80.time,E_Real_Hauptantrieb_80.time,'-or');
grid on;
hold on;
plot(E_Real_Hauptantrieb_60.time,E_Real_Hauptantrieb_60.time,'-oy');
grid on;
hold off;
legend('130 km/h','100 km/h','80 km/h','60 km/h')
but Matlab always crash or show me a black screen Figure does any body know why ?

채택된 답변

Massimo Zanetti
Massimo Zanetti 2016년 9월 27일
편집: Massimo Zanetti 2016년 9월 27일
To plot in the same figure use SUBPLOT. Something like this:
figure;
subplot(2,2,1);
plot(E_Real_Hauptantrieb_130.time,E_Real_Hauptantrieb_130.Data,'-ob');
subplot(2,2,2);
plot(E_Real_Hauptantrieb_100.time,E_Real_Hauptantrieb_100.time,'-og');
subplot(2,2,3);
plot(E_Real_Hauptantrieb_80.time,E_Real_Hauptantrieb_80.time,'-or');
subplot(2,2,4);
plot(E_Real_Hauptantrieb_60.time,E_Real_Hauptantrieb_60.time,'-oy');
Then adjust legends and whatever for each subplot.
  댓글 수: 5
Massimo Zanetti
Massimo Zanetti 2016년 9월 27일
Consider this line for example:
plot(E_Real_Hauptantrieb_130.time,E_Real_Hauptantrieb_130.Data,'-ob');
Being the two vectors E_Real_Hauptantrieb_130.time and E_Real_Hauptantrieb_130.Data too big, Matlab crushes or do not show you the plots. So, you can downsample them (meaning that you can extract only some values from the vectors) so that you can decrease their size. For example try:
plot(decimate(E_Real_Hauptantrieb_130.time,100),decimate(E_Real_Hauptantrieb_130.Data,100),'-ob');
Alex
Alex 2016년 9월 27일
@Zanetti it works !!

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by