请问一下 有没有人知道下面这个图用matlab如何做出来吗

2025-03-23 08:47:00
推荐回答(2个)
回答1:

依我看这是不可能的,因为matlab如果不同纵轴标度的话不会在下面显示,而是在右边显示另一个纵坐标。
直接作图要不到所要结果:
x=1:6;
y=[200 300 100 400 500 300];
z=[0.3 0.5 0.2 0.4 0.3 0.1];
bar(x,y,'g');
hold on
stem(x,z,'r');
hold off
一楼做法比较明智:
x=1:6;
y=[200 300 100 400 500 300];
z=[0.3 0.5 0.2 0.4 0.3 0.1];
subplot(2,1,1);bar(x,y,'g');
subplot(2,1,2);stem(x,z,'r');

回答2:

x=1:6;
y=round(500*rand(1,6))+100;
subplot(211);
bar(y);
subplot(212)
plot(x,y,'d');