problem with displaying multiple plots in one Figure

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 日

3 投票

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 件のコメント

Alex
Alex 2016 年 9 月 27 日
Hi, thnx for the quick answer. I just tried what the code u suggest but i still have the same problem. I think the problem is rather by the size of the time series vector which is by 34 Mb
Massimo Zanetti
Massimo Zanetti 2016 年 9 月 27 日
編集済み: Massimo Zanetti 2016 年 9 月 27 日
Ok, then if you believe the problem is the vector size, try to decimate the vectors (downsampling). Here is an example from Matlab help:
t = 0:.00025:1;
x = sin(2*pi*30*t) + sin(2*pi*60*t);
y = decimate(x,4);
subplot 211
stem(0:120,x(1:121),'filled','markersize',3)
grid on
xlabel 'Sample number',ylabel 'Original'
subplot 212
stem(0:30,y(1:31),'filled','markersize',3)
grid on
xlabel 'Sample number',ylabel 'Decimated'
Alex
Alex 2016 年 9 月 27 日
Hi,
i dont really understand the code what u post, where i souhld exactly put my Data ?
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 件)

タグ

質問済み:

2016 年 9 月 27 日

コメント済み:

2016 年 9 月 27 日

Community Treasure Hunt

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

Start Hunting!

Translated by