做信号分解的时候需要用到的,让多个子图都共用一个x轴
t = 0:0.01:1;
x = sin(t);
y = cos(t);
figure;
subplot(2,1,1);
plot(t,x);
ylabel('Amplitude');
title('Sine Wave');
grid on;
set(gca,'XTickLabel',[]);%去掉第一个子图的x轴刻度
subplot(2,1,2);
plot(t,y);
xlabel('Time (s)');
ylabel('Amplitude');
title('Cosine Wave');
grid on;
这段代码展示了如何在MATLAB中创建两个子图,一个显示sine波,另一个显示cosine波,同时让它们共用同一个时间轴。通过设置XTickLabel为空,第一个子图的x轴刻度被移除,确保两个图形的时间轴一致。
924





