matlab绘制图形(figure)

2025-11-20 06:38:48

1、用于实现左右纵坐标都有数值:

x=0:100;

y1=cos(x/20);

y2=sin(x/20);

plotyy(x,y1,x,y2) %左右纵坐标都有数值

annotation('textarrow',[.3,.6],[.7,.4],'String','ABC'); 

2、绘制白底的背景 figure

set(gcf,'color','w');

3、实现标题变量

title(['xxx=',num2str(num(i)*2),'A'])

4、绘制带箭头的图像

plot(x,y);

a=0.1295;

b=0.108;

annotation('arrow',[a a],[0.8 0.96]);

annotation('arrow',[0.8 0.96],[b b]);

text(150,15.05,'(150,15)','FontSize',10);

5、去掉图像方框

set(gca,'box','off');

6、多组曲线绘图

plot(time,vnew5,'r',time,vnew6,'b',time,vnew7,'g',time,vnew8,'y','linewidth', 4)

title('xxx','fontsize',16)

xlabel('时间(s)','fontsize',16)

ylabel('速度(mm/s)','fontsize',16)

legend(['xxx',num2str(Iref1),'A'],['xxx为',num2str(Iref2),'A'],['xxx',num2str(Iref3),'A'],['xxx',num2str(Iref4),'A']);

声明:本网站引用、摘录或转载内容仅供网站访问者交流或参考,不代表本站立场,如存在版权或非法内容,请联系站长删除,联系邮箱:site.kefu@qq.com。
猜你喜欢