77范文网 - 专业文章范例文档资料分享平台

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

来源:网络收集 时间:2019-03-03 下载这篇文档 手机版
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:或QQ: 处理(尽可能给您提供完整文档),感谢您的支持与谅解。点击这里给我发消息

grid on huidiao=[...

'if i==1,',... 'i=0;,',... 'y=cos(x);,',...

'delete(h),',... 'set(hm,''string'',''正弦函数''),',... 'h=plot(x,y);,',... 'grid on,',... 'else if i==0,',... 'i=1;,',...

'y=sin(x);,',... 'set(hm,''string'',''余弦函数''),',... 'delete(h),',... 'h=plot(x,y);,',... 'grid on,',... 'end,',... 'end'];

hm=uicontrol(gcf,'style','pushbutton',... 'string','余弦函数',... 'callback',huidiao); i=1;

set(hm,'position',[250 20 60 20]); set(gca,'position',[0.2 0.2 0.6 0.6]) title('按钮的使用') hold on

实例34:栅格控制按钮 h0=figure('toolbar','none',...

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

'position',[200 150 450 250],... 'name','实例34'); x=0:0.5:2*pi; y=sin(x); plot(x,y) huidiao1=[...

'set(h_toggle2,''value'',0),',... 'grid on,',... ];

huidiao2=[...

'set(h_toggle1,''value'',0),',... 'grid off,',... ];

h_toggle1=uicontrol(gcf,'style','togglebutton',... 'string','grid on',... 'value',0,...

'position',[20 45 50 20],... 'callback',huidiao1);

h_toggle2=uicontrol(gcf,'style','togglebutton',... 'string','grid off',... 'value',0,...

'position',[20 20 50 20],... 'callback',huidiao2);

set(gca,'position',[0.2 0.2 0.6 0.6]) title('开关按钮的使用')

实例35:编辑框的使用 h0=figure('toolbar','none',...

'position',[200 150 350 250],...

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

'name','实例35'); f='Please input the letter'; huidiao1=[...

'g=upper(f);,',... 'set(h2_edit,''string'',g),',... ]; huidiao2=[...

'g=lower(f);,',... 'set(h2_edit,''string'',g),',... ];

h1_edit=uicontrol(gcf,'style','edit',... 'position',[100 200 100 50],... 'HorizontalAlignment','left',... 'string','Please input the letter',... 'callback','f=get(h1_edit,''string'');',... 'background','w',... 'max',5,... 'min',1); h2_edit=uicontrol(gcf,'style','edit',...

'HorizontalAlignment','left',... 'position',[100 100 100 50],... 'background','w',... 'max',5,... 'min',1); h1_button=uicontrol(gcf,'style','pushbutton',...

'string','小写变大写',... 'position',[100 45 100 20],... 'callback',huidiao1); h2_button=uicontrol(gcf,'style','pushbutton',...

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

'string','大写变小写',... 'position',[100 20 100 20],... 'callback',huidiao2);

实例36:弹出式菜单 h0=figure('toolbar','none',...

'position',[200 150 450 250],... 'name','实例36'); x=0:0.5:2*pi; y=sin(x); h=plot(x,y); grid on

hm=uicontrol(gcf,'style','popupmenu',... 'string',...

'sin(x)|cos(x)|sin(x)+cos(x)|exp(-sin(x))',... 'position',[250 20 50 20]); set(hm,'value',1) huidiao=[...

'v=get(hm,''value'');,',... 'switch v,',... 'case 1,',... 'delete(h),',... 'y=sin(x);,',... 'h=plot(x,y);,',... 'grid on,',... 'case 2,',... 'delete(h),',... 'y=cos(x);,',... 'h=plot(x,y);,',...

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

'grid on,',... 'case 3,',... 'delete(h),',... 'y=sin(x)+cos(x);,',... 'h=plot(x,y);,',... 'grid on,',... 'case 4,',... 'delete(h),',... 'y=exp(-sin(x));,',... 'h=plot(x,y);,',... 'grid on,',... 'end'];

set(hm,'callback',huidiao) set(gca,'position',[0.2 0.2 0.6 0.6]) title('弹出式菜单的使用') hold on

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

百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库数学建模案例MATLAB实用程序百例(7)在线全文阅读。

数学建模案例MATLAB实用程序百例(7).doc 将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印 下载失败或者文档不完整,请联系客服人员解决!
本文链接:https://www.77cn.com.cn/wenku/zonghe/493140.html(转载请注明文章来源)
Copyright © 2008-2022 免费范文网 版权所有
声明 :本网站尊重并保护知识产权,根据《信息网络传播权保护条例》,如果我们转载的作品侵犯了您的权利,请在一个月内通知我们,我们会及时删除。
客服QQ: 邮箱:tiandhx2@hotmail.com
苏ICP备16052595号-18
× 注册会员免费下载(下载后可以自由复制和排版)
注册会员下载
全站内容免费自由复制
注册会员下载
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: