早教吧作业答案频道 -->其他-->
matlab中要求画几条不同的曲线 用不同的颜色 加标题 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');报错了.我也不会这个 怎么搞?
题目详情
matlab中要求画几条不同的曲线 用不同的颜色 加标题
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');
报错了.我也不会这个 怎么搞?
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
结果:
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
结果:
看了 matlab中要求画几条不同...的网友还看了以下:
a1=a2=1,a(n+2)=a(n+1)+tan若t=1时,证明an能被5整除,a(n+5)也能 2020-06-12 …
已知t=arcsinx,求tan(t/2)?作辅助三角形,按照一楼的提示我也做出来了,不过我做出了 2020-06-13 …
求∫dt/tan^n(t) 2020-06-13 …
不止这些,我们还有各种颜色的T血衫.用英语怎么说 2020-06-18 …
"我们有各种颜色的T恤衫,每件20"用英语说wehaveT-shirtsat20each 2020-06-22 …
如图,在平面直角坐标系中,点A的坐标为(9,0),直线y=3/4x+12与x轴,y轴分别交于C,B 2020-07-26 …
我们卖所有颜色的T恤衫(翻译) 2020-08-01 …
英语翻译1,不止这些,我们还有各种颜色的t恤衫2,请到我们商店,并亲自看一看 2020-08-01 …
数学几何在平面直角坐标系中,点A的坐标为(9,0),直线x=3/4x+12与x轴、y轴分别交于C、 2020-08-02 …
在平面直角坐标系中,点A的坐标为(9,0),直线x=3/4x+12与x轴、y轴分别交于C、B,点P是 2020-12-07 …