源代码:
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
运行结果:
本文展示了一个使用Matlab进行简单绘图的例子,包括正弦波和余弦波的绘制,以及如何设置图表的样式、标签和图例等。
源代码:
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
运行结果:
1126

被折叠的 条评论
为什么被折叠?