How to combine plots on subplot?

1 次查看(过去 30 天)
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)

采纳的回答

G A
G A 2019-5-12
编辑:G A 2019-5-12
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')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Visual Exploration 的更多信息

标签

产品


版本

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by