立即学习:https://edu.csdn.net/course/play/25039/288877?utm_source=blogtoedu
%%+空格可以进入cell mode模式
x=rand(1,10);
y=rand(1,10);
figure
plot(x,y,'r-*'); 红色实线星号
%%查询函数信息
edit
%% 内存优化配置
feature memstats
sqrt %可以创建多大的矩阵
%%循环次数多的变量安排在内层
toc过去的时间
%%
%.设置线条的属性
x=0:0.01:2*pi;
y=sin(x);
h=plot(x,y);
grid on
get(h)
set(h,'linestyle','-','linewidth',2,'color','k')
%%.如何修改网格的间隔
set(gca,'xtick',0:0.5:7)
set(gca,'ytick',-1:0.1:1)
%%如何设置图例的字体和大小
x=0:0.01:2pi;
y1=sin(x);
y2=cos(x);
plot(x,y1,'r')
hold on
plot(x,y2,'-.b')
h=legend('sin(x)','cos(x)') %图例的表达
set(h,'fontsize',16,'color','k','edgecolor','r','
textcolor','w')
%%拆分图例
x=0:0.01:2pi;
y1=sin(x);
y2=cos(x);
h1=plot(x,y1,'r')
hold on
h2=plot(x,y2,'-.b')
ax1=axes('position',get(gca,'position'),'visible','off');
legend(ax1,h1,'sin(x)','location','northwest')
ax2=axes('position',get(gca,'position'),'visible','off')';
legend(ax2,h2,'cos(x)','location','northeast')