Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1307897
  • 博文数量: 124
  • 博客积分: 5772
  • 博客等级: 大校
  • 技术积分: 1647
  • 用 户 组: 普通用户
  • 注册时间: 2010-09-27 10:39
文章分类

全部博文(124)

文章存档

2020年(1)

2019年(1)

2018年(5)

2017年(2)

2016年(17)

2015年(3)

2014年(7)

2013年(11)

2012年(13)

2011年(30)

2010年(34)

分类: WINDOWS

2013-01-11 18:21:39


  1. %单y轴
  2. plot(t*1e+9,abs(iGG)/max(abs(iGG)),'k','linewidth',2);
  3. axis([-5,5,0,1])
  4. xlabel('时间/ns');
  5. ylabel('幅度/a.u.');
  6. set(get(gca,'title'),'FontSize',10,'FontName','宋体');%设置标题字体大小,字型
  7. set(get(gca,'XLabel'),'FontSize',10,'FontName','Times New Roman');%设置X坐标标题字体大小,字型
  8. set(get(gca,'YLabel'),'FontSize',10,'FontName','Times New Roman');%设置Y坐标标题字体大小,字型
  9. set(gca,'FontName','Times New Roman','FontSize',10)%设置坐标轴字体大小,字型
  10. text(0.3,1.2,'(a)','FontSize',10,'FontName','Times New Roman'); %设置文本字型字号
  11. set(gca, 'XTick', [0 10 20 30 40 50 60 70 80 90]) %设置X坐标轴刻度数据点位置
  12. set(gca,'XTickLabel',{'0','10','20','30','40','50','60','70','80','90'}) %设置X坐标轴刻度处显示的字符
  13. set(gca, 'YTick', [-15 -10 -5 0 5 10 15]) %设置X坐标轴刻度数据点位置
  14. set(gca,'YTickLabel',{'-15','-10','-5','0','5','10','15'}) %设置Y坐标轴刻度处显示的字符
  15. axis([0,90,-20,20])
  16. set(gca,'YTickLabel',[]); %只显示y坐标轴刻度,不显示y坐标轴的值;
  17. set(gca,'XTickLabel',[]); %只显示x坐标轴刻度,不显示x坐标轴的值;
  18. set(gca,'ytick',[]); %y轴的坐标值和刻度均不显示;
  19. set(gca,'xtick',[]); %x轴的坐标值和刻度均不显示;

  20. figure;
  21. set (gcf,'Position',[400,300,600,200]); %设定plot输出图片的尺寸。参数含义为:xmin,ymin,width,height
  22. %plot的默认参数为[232,246,560,420],Position的单位可以用units属性制定,units属性的值可以是下列字符串中的任何一
  23. %种:pixel(像素,缺省值)、normalized(相对单位)、inches(英寸)、centimeters(厘米)、points(磅)。
  24. %指定大小后,在figure中用text输出的文字大小,设置的是多大,在WORD中显示的就是多大。
  25. set (gcf,'units','centimeters','Position',[4,3,6,2]); %指定fiugre的尺寸为6cm宽,2cm高。
  26. %也可以直接用下属语句:
  27. fiure('units','centimeters','Position',[4,3,6,2]);

  28. %改变ylabel离坐标轴的距离
  29. hc=findobj(allchild(gcf), 'Type', 'axes');
  30. hc2=findobj(allchild(hc), 'Type', 'text');
  31. set(hc2(3), 'Position', [0 0 0]);
  32. %改变xlabel离坐标轴的距离
  33. hc=findobj(allchild(gcf), 'Type', 'axes');
  34. hc2=findobj(allchild(hc), 'Type', 'text');
  35. set(hc2(4), 'Position', [0 0 0]);

  36. %双y轴坐标图形调整
  37. [AX,H1,H2]=plotyy(f*1e-12,abs(T1.*T1),f*1e-12,angle(T1.*T1));
  38. set(AX,'FontSize',14,'FontName','Times New Roman')%设置x轴、左y轴、右y轴刻度字号和字型
  39. set(AX(1),'Xcolor','k','Ycolor','k')%设置x轴、左y轴刻度字体为黑色;
  40. set(AX(2),'Xcolor','k','Ycolor','k')%设置x轴、右y轴刻度字体为黑色;
  41. set(AX,'Xlim',[207.5 217.1],'xtick',[208:1:217])%设置x轴数据范围(207.5到217.1),刻度显示(208,209,210...217)
  42. set(AX(1),'ylim',[0,0.5],'ytick',[0:0.1:0.5])%设置左y轴数据范围(0到0.5),刻度显示(0,0.1,0.2...0.5)
  43. set(AX(2),'ylim',[0,3],'ytick',[0:1:3])%设置右y轴数据范围(0到3),刻度显示(0,1,2,3)
  44. set(H1,'Linestyle','-','color','r','Linewidth',2.5);%设置第一条曲线的线型、颜色、粗细
  45. line(x,y,'linestyle','-','color','r','Linewidth',2.5,'parent',AX(1));%在第一条曲线上再画一条曲线。
  46. set(H2,'Linestyle','-.','color','b','Linewidth',2.5);%设置第二条曲线的线型、颜色、粗细
  47. set(get(AX(1),'Ylabel'),'string','Amplitude(a.u.)','FontSize',10,'FontName','Times New Roman','Position',[0 0 0 ]);%设置左y轴标题字号字型
  48. set(get(AX(2),'Ylabel'),'string','Phase(rad)','FontSize',10,'FontName','Times New Roman');%设置右y轴标题字号字型
  49. set(get(AX(1),'Xlabel'),'string','Optical frequency(THz)','FontSize',10,'FontName','Times New Roman');%设置x坐标标题字体大小,字型


  50. figure
  51. x = 0:0.01:20;
  52. y1 = 200*exp(-0.05*x).*sin(x);
  53. y2 = 0.8*exp(-0.5*x).*sin(10*x);
  54. AX = plotyy(x,y1,x,y2,'plot');
  55. line(x,.5*y1,'linestyle','--','parent',AX(1)) %在第一条曲线上画曲线。

  56. %求极大值的位置:
  57. find(diff(sign(diff(data)))==-2)+1;
  58. %求极小值的位置
  59. find(diff(sign(diff(data)))==2)+1;

  60. %画椭圆
  61. sita=0:pi/20:2*pi;
  62. x0=0;
  63. y0=0;
  64. a=2;
  65. b=4;
  66. fi=0;
  67. plot(x0+a*cos(sita+fi),y0+b*sin(sita+fi),'linewidth',1.5);%fi为方位角,x0,y0为中心点坐标,a/b为长短轴;

  68. %画箭头
  69. annotation('arrow',[0.535 0.62],[0.72 0.72],'LineStyle','-','Linewidth',1.5,'color',[0 0 1])%,'HeadStyle','cback3');
  70. %箭头起始点(0.535,0.72),箭头结束点(0.62,0.72),坐标值为figure的归一化坐标。


阅读(29756) | 评论(1) | 转发(2) |
给主人留下些什么吧!~~

ye_song2016-06-26 23:05:11

谢谢