How to combine plots on subplot?

1 Ansicht (letzte 30 Tage)
Ege Tunç
Ege Tunç am 12 Mai 2019
Bearbeitet: G A am 12 Mai 2019
I need to plot 3 different plots with 4 different datas, however these plots must be subplot. But I cannot hold on them on correct places. What should I do?
black1=[7.0 10.3 14.0 15.4];
white1=[6.8 9.8 12.6 15.1];
pol1=[0.3 0.6 .9 1.1];
alu1=[2.4 3.2 3.7 4.4];
temp1=[83 102 122 133];
black2=[8.4 10.8 17 17.1];
white2=[8 10.7 16.6 16.7];
pol2=[.8 1.6 1.8 1.9];
alu2=[3 3.9 5.5 5.8];
temp2=[90 105.5 134.5 136];
black3=[8 10.8 14.8 14];
white3=[7.8 10.4 14.5 13.5];
pol3=[1.2 1.3 2 0.9];
alu3=[3 3.7 5.2 4.4];
temp3=[89 104 128 135];
xlabel('Temperature as Celcius')
ylabel('Sensor Readings as mV')
hold on
plot(temp1,black1,'ko-'),subplot(3,1,1),hold on
plot(temp1,white1,'go-'),subplot(3,1,1),hold on
plot(temp1,pol1,'bo-'),subplot(3,1,1),hold on
plot(temp1,alu1,'ro-'),subplot(3,1,1),hold on
plot(temp2,black2,'kx--'),subplot(3,1,2),hold on
plot(temp2,white2,'gx--'),subplot(3,1,2),hold on
plot(temp2,pol2,'bx--'),subplot(3,1,2),hold on
plot(temp2,alu2,'rx--'),subplot(3,1,2),hold on
plot(temp3,black3,'k.-'),subplot(3,1,3),hold on
plot(temp3,white3,'g.-'),subplot(3,1,3),hold on
plot(temp3,pol3,'b.-'),subplot(3,1,3),hold on
plot(temp3,alu3,'r.-'),subplot(3,1,3)

Akzeptierte Antwort

G A
G A am 12 Mai 2019
Bearbeitet: G A am 12 Mai 2019
figure(1)
clf
subplot(3,1,1)
hold on
plot(temp1,black1,'ko-'),
plot(temp1,white1,'go-'),
plot(temp1,pol1,'bo-'),
plot(temp1,alu1,'ro-'),
subplot(3,1,2)
hold on
plot(temp2,black2,'kx--'),
plot(temp2,white2,'gx--'),
plot(temp2,pol2,'bx--'),
plot(temp2,alu2,'rx--'),
ylabel('Sensor Readings as mV')
subplot(3,1,3)
hold on
plot(temp3,black3,'k.-'),
plot(temp3,white3,'g.-'),
plot(temp3,pol3,'b.-'),
plot(temp3,alu3,'r.-'),
xlabel('Temperature as Celcius')

Weitere Antworten (0)

Tags

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by