% compare(lnx/x/sinx/e^x)
x=0:0.01:+4;
y1=log(x);
y2=x;
y3=x.*x;
y4=sin(x);
y5=exp(x);
% plot(x,y1,y2,y3,y4,y5);grid on
plot(x,y1,'r');
hold on
plot(x,y2,'b');
hold on
plot(x,y3,'g');
hold on
plot(x,y4,'b');
hold on
plot(x,y5,'o');
title 'compare';
grid on
% hold on 留住之前画的图像
xlabel('x zhou');
ylabel('y zhou');
[X,Y]=meshgrid(-4:0.1:4,-4:0.1:4);
% Z=cos(X).*sin(Y);
% ctrl+R ctrl+t quxiaozhushi
Z= X^2+ sqrt(abs(Y))+log(abs(X))+sin(Y);
mesh(X,Y,Z);
% sqrt开方,abs绝对值
% mesh: only grid
% surf: add surface
xlabel('x');
ylabel('y');
zlabel('z');
标签:plot,y2,练习,画图,matlab,y1,y3,hold,y5
From: https://www.cnblogs.com/zlr585/p/17632758.html