数学建模案例MATLAB实用程序百例(8)

2019-03-03 19:34

实例37:滑标的使用 h0=figure('toolbar','none',...

'position',[200 150 450 250],... 'name','实例37'); [x,y]=meshgrid(-8:0.5:8); r=sqrt(x.^2+y.^2)+eps; z=sin(r)./r; h0=mesh(x,y,z); h1=axes('position',... [0.2 0.2 0.5 0.5],... 'visible','off'); htext=uicontrol(gcf,...

'units','points',... 'position',[20 30 45 15],... 'string','brightness',... 'style','text'); hslider=uicontrol(gcf,...

'units','points',...

'position',[10 10 300 15],... 'min',-1,... 'max',1,...

'style','slider',... 'callback',...

'brighten(get(hslider,''value''))');

实例38:多选菜单 h0=figure('toolbar','none',...

'position',[200 150 450 250],... 'name','实例38');

file:///E|/Document/发展篇/M&M/竞赛篇/常用算法/matlab 实例/5.txt[2010/5/14 1:14:31]

[x,y]=meshgrid(-8:0.5:8); r=sqrt(x.^2+y.^2)+eps; z=sin(r)./r; h0=mesh(x,y,z); hlist=uicontrol(gcf,'style','listbox',...

'string','default|spring|summer|autumn|winter',... 'max',5,... 'min',1,...

'position',[20 20 80 100],... 'callback',[... 'k=get(hlist,''value'');,',... 'switch k,',... 'case 1,',...

'colormap default,',... 'case 2,',...

'colormap spring,',... 'case 3,',...

'colormap summer,',... 'case 4,',...

'colormap autumn,',... 'case 5,',...

'colormap winter,',... 'end']);

实例39:菜单控制的使用 h0=figure('toolbar','none',...

'position',[200 150 450 250],... 'name','实例39'); x=0:0.5:2*pi;

file:///E|/Document/发展篇/M&M/竞赛篇/常用算法/matlab 实例/5.txt[2010/5/14 1:14:31]

y=cos(x); h=plot(x,y); grid on

set(gcf,'toolbar','none') hm=uimenu('label','example'); huidiao1=[...

'set(hm_gridon,''checked'',''on''),',... 'set(hm_gridoff,''checked'',''off''),',... 'grid on'];

huidiao2=[...

'set(hm_gridoff,''checked'',''on''),',... 'set(hm_gridon,''checked'',''off''),',... 'grid off'];

hm_gridon=uimenu(hm,'label','grid on',... 'checked','on',... 'callback',huidiao1);

hm_gridoff=uimenu(hm,'label','grid off',... 'checked','off',... 'callback',huidiao2);

实例40:UIMENU菜单的应用 h0=figure('toolbar','none',...

'position',[200 150 450 250],... 'name','实例40');

h1=uimenu(gcf,'label','函数'); h11=uimenu(h1,'label','轮廓图',... 'callback',[...

'set(h31,''checked'',''on''),',... 'set(h32,''checked'',''off''),',...

file:///E|/Document/发展篇/M&M/竞赛篇/常用算法/matlab 实例/5.txt[2010/5/14 1:14:31]

'[x,y,z]=peaks;,',... 'contour3(x,y,z,30)']);

h12=uimenu(h1,'label','高斯分布',... 'callback',[...

'set(h31,''checked'',''on''),',... 'set(h32,''checked'',''off''),',... 'mesh(peaks);,',... 'axis tight']); h13=uimenu(h1,'label','Sinc函数',...

'callback',[... 'set(h31,''checked'',''on''),',... 'set(h32,''checked'',''off''),',... '[x,y]=meshgrid(-8:0.5:8);,',... 'r=sqrt(x.^2+y.^2)+eps;,',... 'z=sin(r)./r;,',... 'mesh(x,y,z)']);

h2=uimenu(gcf,'label','色彩'); hl2(1)=uimenu(h2,'label','Default',...

'checked','on',... 'callback',... [...

'set(hl2,''checked'',''off''),',... 'set(hl2(1),''checked'',''on''),',... 'colormap(''default'')']);

hl2(2)=uimenu(h2,'label','spring',... 'callback',... [...

'set(hl2,''checked'',''off''),',... 'set(hl2(2),''checked'',''on''),',...

file:///E|/Document/发展篇/M&M/竞赛篇/常用算法/matlab 实例/5.txt[2010/5/14 1:14:31]

'colormap(spring)']); hl2(3)=uimenu(h2,'label','Summer',...

'callback',... [...

'set(hl2,''checked'',''off''),',... 'set(hl2(3),''checked'',''on''),',... 'colormap(summer)']);

hl2(4)=uimenu(h2,'label','Autumn',... 'callback',... [...

'set(hl2,''checked'',''off''),',... 'set(hl2(4),''checked'',''on''),',... 'colormap(autumn)']);

hl2(5)=uimenu(h2,'label','Winter',... 'callback',... [...

'set(hl2,''checked'',''off''),',... 'set(hl2(5),''checked'',''on''),',... 'colormap(winter)']);

h3=uimenu(gcf,'label','坐标选项'); h31=uimenu(h3,'label','Axis on',...

'callback',... [...

'axis on,',... 'set(h31,''checked'',''on''),',... 'set(h32,''checked'',''off'')']); h32=uimenu(h3,'label','Axis off',...

'callback',... [...

file:///E|/Document/发展篇/M&M/竞赛篇/常用算法/matlab 实例/5.txt[2010/5/14 1:14:31]


数学建模案例MATLAB实用程序百例(8).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:中医内科学Z 第7次

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: