y1=sin(t);
y2=cos(t);
y3=tan(t);
plot(t,y1,'r-';t,y2,'g';t,y3,'k');
legend('Vdc1','Vdc2');
grid on;hold on;
title('Vdc_PN');
报错了。。我也不会这个 怎么搞?
在线等!
原因:
plot(t,y1,'r-';t,y2,'g';t,y3,'k')这里面出现了分号(;),应该改成逗号。
由于tan会出现无穷大,所以图要分开画。
没有定义t的取值范围
程序改成如下:
t=-2*pi:0.01:2*pi;
y1=sin(t);
y2=cos(t);
y3=tan(t);
subplot(211)
plot(t,y1,'r-',t,y2,'g');
legend('sin(t)','cos(t)');
grid on;
title('Vdc_PN');
subplot(212)
ezplot('tan(t)')%由于tan会出现无穷大,所以分开画
grid on
结果:
追问瓦萨。。。。
谢谢了!!