作业帮 > 综合 > 作业

新手使用matlab出现Error using ==> plot Vectors must be the same le

来源:学生作业帮 编辑:作业帮 分类:综合作业 时间:2024/05/16 08:04:59
新手使用matlab出现Error using ==> plot Vectors must be the same lengths.
subplot(3,1,1)
x1=-pi:pi/50:pi;
y1=x.*cos(x);
plot(x1,y1,'m.')
grid on,
title('y=xcosx'),xlabel('x轴'),ylabel('y轴')
gtext('y=xcosx'),legend('y=xcosx')
subplot(3,1,2)
x2=pi:pi/50:4*pi;
y2=x.*tan(1./x).*sin(x^3);
plot(x2,y2,'g*'),grid on,
title('y=xtan(1/x)sinx^3'),xlabel('x轴'),ylabel('y轴')
gtext('y=xtan(1/x)sinx^3'),legend('y=xtan(1/x)sinx^3')
subplot(3,1,3)
x3=1:1/50:8;
y3=exp(1./x).*sin(x);
plot(x3,y3,'rd'),grid on,
title('e^(1/3)sinx'),xlabel('x轴'),ylabel('y轴')
gtext('e^(1/3)sinx'),legend('e^(1/3)sinx')
subplot(3,1,2)
x2=pi:pi/50:4*pi;
y2=x.*tan(1./x).*sin(x^3); 改为y2=x.*tan(1./x).*sin(x.^3)