Matlab画图常用命令

来源:互联网 发布:只有我知双语未删减版 编辑:程序博客网 时间:2024/06/06 02:05

1.设置标题

figure;set(gcf,'Name','csdn');

2.设置坐标轴范围

figure;axis([0 inf -10 10]);  %前两个值为x轴,后面的为y

3.设置坐标轴范围及步长

figure;set(gca,'ytick',-10:1:10);   %设置y轴,x轴同理

4.多次在同一图像上画图

在每次figure或plot后使用hold on;

5.添加图例

h1 = plot(...,'*k');h2 = plot(...,'*r');h3 = plot(...,'*g');h4 = plot(...,'*b');legend([h1,h2,h3,h4],'黑星','红星','绿星','蓝星',...    'Location','westoutside','Orientation','vertical');
原创粉丝点击