怎样用matlab将几条曲线画在一个图上

如题所述

fs=100;
t = -1:.1/fs:1;
y1=sin(2*pi*t);
y2=cos(2*pi*t)

plot(y1);
hold on
plot(y2,'r');
这样两条曲线就画出来了,为了区分,第二条我用了红色
温馨提示:答案为网友推荐,仅供参考
第1个回答  2012-09-28
hold on,之后的绘图操作都会画在当前图上,画完后hold off关闭
第2个回答  2012-09-28
x = -pi:.1:pi;
plot(sin(x));
hold all % hold all是关键
plot(sin(x+(pi/4)));