马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
当设定好sin(x)曲线的线型、颜色等性质后,再点exp(-x),曲线的性质就又变回到默认状态了!
我希望选取exp(-x)时,保持在sin(x)设定好的曲线性质,请问该如何编程?谢谢~
- close,clear,clc
- figure(1)
- set(gcf,'Position',[100,300,300,200],...
- 'Numbertitle','off',...
- 'Name','GuiDm_1')
- x=0:0.1:10;
- y=sin(x);
- p=plot(x,y);
- xlabel('x');
- ylabel('y=sin(x)');
- stl=uimenu(gcf,...
- 'Label','select equation',...
- 'BackgroundColor',[0.8,0.8,0.8])
- s=uimenu(gcf,...
- 'Label','Line style',...
- 'BackgroundColor',[0.8,0.8,0.8],...
- 'Position',8);
- c=uimenu(gcf,...
- 'Label','Line Color',...
- 'BackgroundColor',[0.8,0.8,0.8],...
- 'Position',9);
- w=uimenu(gcf,...
- 'Label','Line width',...
- 'BackgroundColor',[0.8,0.8,0.8],...
- 'Position',10);
- f1=uimenu(stl,...
- 'Label','y=sin(x)',...
- 'CallBack','p=plot(x,sin(x));xlabel(''x'');ylabel(''y=sin(x)'')')
- f2=uimenu(stl,...
- 'Label','y=exp(-x)',...
- 'CallBack','p=plot(x,exp(-x));xlabel(''x'');ylabel(''y=exp(-x)'')')
- solid=uimenu(s,...
- 'Label','Solid',...
- 'CallBack','set(p,''LineStyle'',''-'')')
- dotted=uimenu(s,...
- 'Label','Dotted',...
- 'CallBack','set(p,''LineStyle'','':'')')
- yellow=uimenu(c,...
- 'Label','Yellow',...
- 'BackgroundColor',[0.9,0.9,0.1],...
- 'CallBack','set(p,''Color'',''g'')')
- green=uimenu(c,...
- 'Label','Green',...
- 'BackgroundColor',[0.1,0.9,0.1],...
- 'CallBack','set(p,''Color'',''g'')')
- red=uimenu(c,...
- 'Label','Red',...
- 'BackgroundColor',[0.9,0.1,0.1],...
- 'CallBack','set(p,''Color'',''r'')')
- thin=uimenu(w,...
- 'Label','thin0.5',...
- 'CallBack','set(p,''LineWidth'',0.5)')
- thick=uimenu(w,...
- 'Label','thick2.0',...
- 'CallBack','set(p,''LineWidth'',2.0)')
复制代码 |