MATLAB大作业.docx

上传人:lao****ou 文档编号:788872 上传时间:2024-05-22 格式:DOCX 页数:10 大小:176.83KB
下载 相关 举报
MATLAB大作业.docx_第1页
第1页 / 共10页
MATLAB大作业.docx_第2页
第2页 / 共10页
MATLAB大作业.docx_第3页
第3页 / 共10页
MATLAB大作业.docx_第4页
第4页 / 共10页
MATLAB大作业.docx_第5页
第5页 / 共10页
亲,该文档总共10页,到这儿已超出免费预览范围,如果喜欢就下载吧!
资源描述

《MATLAB大作业.docx》由会员分享,可在线阅读,更多相关《MATLAB大作业.docx(10页珍藏版)》请在第一文库网上搜索。

1、WJm用B大作业计算器设计姓名:*J.:=,-1_1-1不不不不不不不下不不班级:信息与计算科学2011年12月20日摘要:图形用户界面(GUI)是指由窗口、菜单、图标、光标、按键、对话框和文本等各种图形对象组成的用户界面。它让用户定制用户与Mat1ab的交互方式,而命令窗口不是唯一与Mat1ab的交互方式。关键字:控件对象和用户界面菜单对象、实现功能(1)实现简单的加、减、乘、除运算;(2)实现取余取整运算(3)实现三角运算(4)实现背景改变二、算法实现打开Inat1ab程序,如下建立guide算法实现GUIDEQuickStartCreateNewGUIOpenExistingGUISav

2、enewfigureas:GUIDEtempIatesQBIankGUI(DefauIt)4OUIwithUicontro1s4GUIwithAxesandMenu4Moda1QuestionDia1ogIOK1在建立edittext和StatiCteXt如下图所示:2、各控件的实现:右击按钮进入ca11back,从创建到显示处代码如下:加减乘除函数部分%一Executesonbuttonpressinpushbutton1.functionpushbutton1_Ca11back(hObject,eventdata,hand1es)s1=str2doub1e(get(hand1es.edit

3、1,String*)s2=str2doub1e(get(hand1es.edit2,String*)set(hand1es.edit3Strings1+s2);%eventdatareserved-tobedefinedinafutureversionofMAT1AB%hand1esstructurewithhand1esanduserdata(seeGUIDATA)%-Executesonbuttonpressinpushbutton?.functionpushbutton2_Ca11back(hObject,eventdata,hand1es)s1=str2doub1e(get(hand1

4、es.edit1,String*)s2=str2doub1e(get(hand1es.edit2String,)set(hand1es.edit39,String9s1s2);%hbjecthand1etopushbutton2(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMAT1AB%hand1esstructurewithhand1esanduserdata(seeGUIDATA)%Executesonbuttonpressinpushbutton3.functionpushbutton3_Ca11back(hObject

5、,eventdata,hand1es)s1=str2doub1e(get(hand1es.edit1,String*)s2=str2doub1e(get(hand1es.edit2,String*)set(hand!es.edit3Strings1*s2);%hbjecthand1etopushbutton3(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMAT1AB%Executesonbuttonpressinpushbutton4.functionPUShbUtton4_Ca11baCk(hbject,eventdata,

6、hand1es)s1=str2doub1e(get(hand1es.edit1,String*)s2=str2doub1e(get(hand1es.edit2String,)set(hand1es.edit3Strings1-s2);%hbjecthand1etopushbutton4(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMAT1AB%hand1esstructurewithhand1esanduserdata(seeGUIDATA)三角函数部分functionpushbutton6_Ca11back(hObject,

7、eventdata,hand1es)jiaodu=str2num(get(hand1es.edit1String,);hudu=(jiaodu)180*pi;r=sin(hudu);set(hand1esedit3Stringnum2str(r);%hbjecthand1etopushbutton6(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMAT1AB%Executesonbuttonpressinpushbutton7.functionpushbutton7_Ca11back(hObject,eventdata,hand

8、1es)jiaodu=str2num(get(hand1es.edit1String,);hudu=(jiaodu)180*pi;r=cos(hudu);set(hand1es.edit3Stringnum2str(r);%hbjecthand1etopushbutton?(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMAT1AB%hand1esstructurewithhand1esanduserdata(seeGUIDATA)%Executesonbuttonpressinpushbutton8.functionpushb

9、utton8_Ca11back(hObject,eventdata,hand1es)jiaodu=str2num(get(hand1es.edit1String,);hudu=(jiaodu)180*pi;r=tan(hudu);set(hand1esedit39Stringnum2str(r);%hbjecthand1etopushbutton8(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMAT1AB改变背景部分%Executesonbuttonpressinpushbutton9.functionpushbutton9_

10、Ca11back(hObject,eventdata,hand1es)set(hand1es.uipane11backgroundco1or0.60.9020.608);取余数取整数部分functionpushbutton11_Ca11back(hObject,eventdata,hand1es)s1=str2doub1e(get(hand1es.edit1,String*)s2=str2doub1e(get(hand1es.edit2,String*)set(hand1es.edit3Stringmod(s1,s2);%hbjecthand1etopushbutton11(seeGCBO)%

11、eventdatareserved-tobedefinedinafutureversionofMAT1AB%hand1esstructurewithhand1esanduserdata(seeGUIDATA)%Executesonbuttonpressinpushbutton12.functionpushbutton12_Ca11back(hObject,eventdata,hand1es)s1=str2doub1e(get(hand1es.edit1,String*)s2=str2doub1e(get(hand1es.edit2String,)set(hand1es.edit3Stringfix(s1s2);三、运行界面四、改变颜色四、参考文献1 .MAT1ABR2007基础教程刘慧颖编著2 .http:ZhidaO上

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 应用文档 > 工作总结

copyright@ 2008-2022 001doc.com网站版权所有   

经营许可证编号:宁ICP备2022001085号

本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有,必要时第一文库网拥有上传用户文档的转载和下载权。第一文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知第一文库网,我们立即给予删除!



客服