源代码:
t=[0:pi/20:4*pi];
hold on
axis([0 4*pi -10 10])
plot(t,10*sin(t),'r+:')
plot(t,5*cos(t),'b*--')
xlabel('时间t');
ylabel('幅度X');
title('简单绘图示例');
legend('x1=10sint:点画线','x2=5cost:虚线')
gtext('x1');
gtext('x2');
grid on
运行结果:
源代码:
t=[0:pi/20:4*pi];
hold on
axis([0 4*pi -10 10])
plot(t,10*sin(t),'r+:')
plot(t,5*cos(t),'b*--')
xlabel('时间t');
ylabel('幅度X');
title('简单绘图示例');
legend('x1=10sint:点画线','x2=5cost:虚线')
gtext('x1');
gtext('x2');
grid on
运行结果: