matlab课程设计修改最终版_第1页
matlab课程设计修改最终版_第2页
matlab课程设计修改最终版_第3页
matlab课程设计修改最终版_第4页
matlab课程设计修改最终版_第5页
已阅读5页,还剩36页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

PAGE1课程设计报告(2011--2012年度第2学期)名称:MATLAB课程设计与应用题目:计算器界面设计及运算实现院系:理学院班级:10统计1指导教师:陈华老师设计周数:一周小组成员姓名学号:冯文铎1011112105刘思1011112125董宽1011112113李鹏飞1011112119日期:2012年6月6日目录课程设计目的……………………2课程设计任务……………………2GUI设计过程……………………23.1新建GUI设计窗口…………23.2GUI设计窗口操作……………33.3GUI窗口的实现………………44.函数命令设计过程………………95.不足之处…………126.总结………………127.参考文献…………138.附件………………13科学计算器对话框设计及运算实现课程设计目的MATLAB是一种以数值计算和数据图示为主的计算机软件,并包含适应多个学科的专业软件包,以及完善程序开发功能。进行此课程设计旨在悉MATLAB的功能,掌握MATLAB程序设计和GUI设计的方法,在实际的操作中巩固学习内容。课程设计任务此课程设计,要使用MATLAB软件进行操作,通过图形用户界面GUI设计窗口,操作GUI设计窗口左边的控件工具栏,产生界面中我们需要的科学计算器的相关按钮,在对象属性查看器中进行相应的设置。GUI设计过程3.1新建GUI设计窗口打开matlab选file〉new>GUI>BlankGUI(default)得到了下面的设计窗口3.2GUI设计窗口操作(科学计算器所需的按钮产生与设置)点击ok键在窗口中产生pushbutton键,安放需要设定的科学计算器所需的按键的位置。然后在点击edit后在窗口中上处点住拉到符合要求的大小,用PropertyInspector的设置把显示结果的窗口的字符清空得到如下图型:然后对每个pushbutton键进行设置,双击后产生的对象属性查看器中,string设置每个按钮的名称,分别为‘sin、sin-1、ln、e^x、AC、cos、cos-1、log、10^x、DEL、tan、tan-1、x^2、x^1/2、=、y^x、1/x、%、(、)、7、8、9、+、4、5、6、-、1、2、3、*、0、.、+/-、/’一共有36个键。在我们用GUI时为了美观我们用PropertyInspector的设置把按键设置为深蓝色的,把按键上的字符设置为白色,把函数‘sin、sin-1、ln、e^x、cos、cos-1、log、10^x、tan、tan-1、x^2、x^1/2、y^x、1/x、%、(、)’的按键的大小设置为hight为2,width为6,而‘AC,DEL,=,1,2,3,4,5,6,7,8,9,0,-,+,*,/,+/-,.’按键hight为2,width为8,并且‘AC’和‘DEL’按键的颜色设为红色,而‘=’按键设为青绿色后得到如下图型:3.3GUI窗口的实现(科学计算器的功能实现)在GUI窗口中已经产生了一个符合要求的科学计算器的界面,为了使计算器实现其运算功能,需要对每个按钮的实现进行编程。3.3.1首先打开M-fileEditor文件,在functionuntitled50_OpeningFcn(hObject,eventdata,handles,varargin)handles.output=hObject;%Updatehandlesstructureguidata(hObject,handles);的后面添加set(handles.figure1,'Name','科学计算器');%是把标题变为‘科学计算器’set(handles.edit1,'string','');%是把计算器的显示器清空然后运行就得到了如下图:(在左上角由‘untitled50.fig’变为‘科学计算器’了)3.3.2接下来对数字按键进行编程如‘7’:选中‘7’键,鼠标右击选中viewcallbacks再选中callback点击后在functionpushbutton6_Callback(hObject,eventdata,handles)后面加str1=get(handles.pushbutton6,'string');%得到结果显示器的字符str2=get(handles.edit1,'string');%得到按键‘7’的字符string=strcat(str2,str1);%把两个字符串合并set(handles.edit1,'string',string);%把合并后的字符串重新付给edit,作为结果显示器的字符而按键‘1,2,3,4,5,6,8,9,0,-,+,*,/,+/-,.,(,)’同按键‘7’的步骤一样。其实'y^x'按键和'7'按键也一致,只是得到按键字符串时'^'。3.3.3接下来是‘sin,cos,tan’函数的程序编制,如函数'sin':选中‘sin’键,鼠标右击选中viewcallbacks再选中callback点击后在functionpushbutton2_Callback(hObject,eventdata,handles)后面加string=get(handles.edit1,'string');%得到结果显示器edit的字符k=find(string=='+'|string=='-'|string=='*'|string=='/'|string=='(');%得到'+,-,*,/'的位置u=max(k);%得到k的最大值ifu>=2str4=string(1:u);%得到字符串'string'的1到u个字符str1=string(u+1:end);%得到字符串'string'的u以后的几个字符n=eval(str1);%计算字符串'str1'所对应的结果jieguo1=n/180*pi;%把n变为多少πm=sin(jieguo1);%得出正弦值str2=num2str(m);%把m变为字符型jieguo=strcat(str4,str2);%把str4和str2合并为jieguoset(handles.edit1,'string',jieguo);%把合并后的字符串重新付给edit,作为结果显示器的字符elseifstring(u)=='('%如果k的最大位置上是'('str4=string(u);%把string的第u个字符给str4str1=string(u+1:end);%把string的第U+1到最后一个字符给str1n=eval(str1); %计算出str1的值给njieguo1=n/180*pi; %把n变为多少πm=sin(jieguo1);%得出正弦值str2=num2str(m);%把m变为字符型jieguo=strcat(str4,str2);%把str4和str2合并为jieguoset(handles.edit1,'string',jieguo);%把合并后的字符串重新付给edit,作为结果显示器的字符else%如果第一个字符就是数字jieguo1=eval(string);%计算出string的值给jieguojieguo2=jieguo1/180*pi;%把jieguo变为多少πjieguo=sin(jieguo2);%得出正弦值set(handles.edit1,'string',jieguo);%把合并后的字符串重新付给edit,作为结果显示器的字符end而按键'cos,tan'同按键'sin'的大致一样。而'cos,tan,sin-1,cos-1,tan-1'按键也大致一样,只是'tan-1'中的值可以大于1,而'sin-1,cos-1'中的值要小于1。其实'1/x,ln,log,x^2,%,e^x,10^x,x^1/2'都大致一样,只是在其中添加了各自所需计算的函数程序而已。3.3.4接下来是‘AC,DEL,=’函数的程序编制AC按键:在functionpushbutton36_Callback(hObject,eventdata,handles)后面添加set(handles.edit1,'string','');即可。DEL按键:在functionpushbutton37_Callback(hObject,eventdata,handles)后添加string=get(handles.edit1,'string');%得到显示器edit的字符串ss=char(string);%把string变为字符型l=length(ss);%得到ss的字符长度set(handles.edit1,'string',ss(1:l-1));%把ss的1到l-1个字符给显示器edit,即删除最后一个字符。=按键:在functionpushbutton38_Callback(hObject,eventdata,handles)后添加string=get(handles.edit1,'string');%得到显示器edit的字符串jieguo=eval(string);%计算string的值set(handles.edit1,'string',jieguo);%把计算值给edit,作为结果显示器的字符。最后运行后就得到如下界面:(可以运算)函数命令设计过程打开file-M-file输入hf=figure('Color',[1,1,1],'Position',[100,200,600,450],...'Name','科学计算器','NumberTitle','off','MenuBar','none');he=uicontrol(hf,'Style','Edit','Units','normalized',...'Position',[0.2,0.88,0.6,0.1],'Back',[1,1,1],'Horizontal','right');h1=uicontrol(hf,'Style','Push','Units','normalized',...'Position',[0.25,0.78,0.06,0.06],'Horizontal','center',...'String','sin','back',[0.67,0,1],'Call','m1');……..h36=uicontrol(hf,'Style','Push','Units','normalized',...'Position',[0.65,0.08,0.07,0.07],'Horizontal','center',...'String','/','Back',[0.67,0,1],'Call','m36');然后运行得到如下界面:可以看出一共有36个按键,就有36个’call’,在M-file中编写36个M-file函数,如:string=get(he,'string');k=find(string=='+'|string=='-'|string=='*'|string=='/'|string=='(');u=max(k);ifu>=2str4=string(1:u);str1=string(u+1:end);n=eval(str1);jieguo1=n/180*pi;m=sin(jieguo1);str2=num2str(m);jieguo=strcat(str4,str2);set(he,'string',jieguo);elseifstring(u)=='('str4=string(u);str1=string(u+1:end);n=eval(str1);jieguo1=n/180*pi;m=sin(jieguo1);str2=num2str(m);jieguo=strcat(str4,str2);set(he,'string',jieguo);elsejieguo1=eval(string);jieguo2=jieguo1/180*pi;jieguo=sin(jieguo2);set(he,'string',jieguo);end就保存在m1.m中,在科学计算器运行时,当点击到’sin’按键时就会调用m1.m中的函数,其他按键以此类推一共有m1.m到m36.m,函数程序和GUI设计函数程序大致相同,在此不一一列举了。5.不足之处在清屏后不能再显示器edit中显示‘0.’。没有做到更人性化,还是有点不美观。在函数命令设计中我们不能把界面做的和GUI设计的一致,如按键上的字符串的字体颜色,按键颜色等。(四)函数命令程序太过繁琐。(五)实现科学计算器的功能太少。6.总结此次的课程实际,是针对MTLAB课程进行的,在平时的学习当中,我们了解了软件所具有的很多功能。在不断的操作中熟悉所了解的知识,每次的上机实验是实践的主要部分。通过这次设计,再次在实践中学习。团队合作,运用自身的优势,发挥合作的功效,很顺利的完成了这次实践作业。首先,我们对设计的界面进行了选择,一致决定设计科学计算器的界面,便顺利的进行了GUI界面的设计。对于科学计算器功能的实习,需要加以编程。编程是一个比较复杂也相对其他部分,有一定的难度。经过学习,花费了一定的时间,最终也得到了实现。之后,对于此设计界面功能实现是否可行,我们进行了多次的检验,没有计算的问题。我们在学习和设计的过程中,总结发现,很多实际问题在对课本知识的学习当中并不能完全的发掘与体现,只有在实践中,通过自身反复的尝试操作,才能发现一些问题并很好的解决问题。也正是通过了认真的学习,才使得实践设计过程没那么多的困难,从中获益良多。更发现了MATLAB此软件功能的强大,与运用的有利之处。参考文献【1】刘卫国编《MATBLE程序设计与应用》高等教育出版社2006版【2】张圣勤编《MATABLE7.0实用教程》机械工业出版社2006版【3】刘金琨.先进PID控制与MATLAB仿真[M].北京:电子工业出版社,2003.1.TP273/L587.2【4】刘金琨.滑模变结构控制与MATLAB仿真北京清华大学出版社,2005.10.TP273/L587.2-28.附件GUI设计程序functionvarargout=untitled50(varargin)%UNTITLED50M-fileforuntitled50.fig%UNTITLED50,byitself,createsanewUNTITLED50orraisestheexisting%singleton*.%%H=UNTITLED50returnsthehandletoanewUNTITLED50orthehandleto%theexistingsingleton*.%%UNTITLED50('CALLBACK',hObject,eventData,handles,...)callsthelocal%functionnamedCALLBACKinUNTITLED50.Mwiththegiveninputarguments.%%UNTITLED50('Property','Value',...)createsanewUNTITLED50orraisesthe%existingsingleton*.Startingfromtheleft,propertyvaluepairsare%appliedtotheGUIbeforeuntitled50_OpeningFunctiongetscalled.An%unrecognizedpropertynameorinvalidvaluemakespropertyapplication%stop.Allinputsarepassedtountitled50_OpeningFcnviavarargin.%%*SeeGUIOptionsonGUIDE'sToolsmenu.Choose"GUIallowsonlyone%instancetorun(singleton)".%%Seealso:GUIDE,GUIDATA,GUIHANDLES%Copyright2002-2003TheMathWorks,Inc.%Edittheabovetexttomodifytheresponsetohelpuntitled50%LastModifiedbyGUIDEv2.501-Jun-201200:22:55%Begininitializationcode-DONOTEDITgui_Singleton=1;gui_State=struct('gui_Name',mfilename,...'gui_Singleton',gui_Singleton,...'gui_OpeningFcn',@untitled50_OpeningFcn,...'gui_OutputFcn',@untitled50_OutputFcn,...'gui_LayoutFcn',[],...'gui_Callback',[]);ifnargin&&ischar(varargin{1})gui_State.gui_Callback=str2func(varargin{1});endifnargout[varargout{1:nargout}]=gui_mainfcn(gui_State,varargin{:});elsegui_mainfcn(gui_State,varargin{:});end%Endinitializationcode-DONOTEDIT%Executesjustbeforeuntitled50ismadevisible.functionuntitled50_OpeningFcn(hObject,eventdata,handles,varargin)%Thisfunctionhasnooutputargs,seeOutputFcn.%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%varargincommandlineargumentstountitled50(seeVARARGIN)%Choosedefaultcommandlineoutputforuntitled50handles.output=hObject;%Updatehandlesstructureguidata(hObject,handles);%UIWAITmakesuntitled50waitforuserresponse(seeUIRESUME)%uiwait(handles.figure1);set(handles.figure1,'Name','科学计算器');set(handles.edit1,'string','');%Outputsfromthisfunctionarereturnedtothecommandline.functionvarargout=untitled50_OutputFcn(hObject,eventdata,handles)%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Getdefaultcommandlineoutputfromhandlesstructurevarargout{1}=handles.output;functionedit1_Callback(hObject,eventdata,handles)%hObjecthandletoedit1(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Hints:get(hObject,'String')returnscontentsofedit1astext%str2double(get(hObject,'String'))returnscontentsofedit1asadouble%Executesduringobjectcreation,aftersettingallproperties.functionedit1_CreateFcn(hObject,eventdata,handles)%hObjecthandletoedit1(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesempty-handlesnotcreateduntilafterallCreateFcnscalled%Hint:editcontrolsusuallyhaveawhitebackgroundonWindows.%SeeISPCandCOMPUTER.ifispcset(hObject,'BackgroundColor','white');elseset(hObject,'BackgroundColor',get(0,'defaultUicontrolBackgroundColor'));end%Executesonbuttonpressinpushbutton2.functionpushbutton2_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton2(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)string=get(handles.edit1,'string');k=find(string=='+'|string=='-'|string=='*'|string=='/'|string=='(');u=max(k);ifu>=2str4=string(1:u);str1=string(u+1:end);n=eval(str1);jieguo1=n/180*pi;m=sin(jieguo1);str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elseifstring(u)=='('str4=string(u);str1=string(u+1:end);n=eval(str1);jieguo1=n/180*pi;m=sin(jieguo1);str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elsejieguo1=eval(string);jieguo2=jieguo1/180*pi;jieguo=sin(jieguo2);set(handles.edit1,'string',jieguo);end%Executesonbuttonpressinpushbutton3.functionpushbutton3_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton3(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)string=get(handles.edit1,'string');k=find(string=='+'|string=='-'|string=='*'|string=='/'|string=='(');u=max(k);ifu>=2str4=string(1:u);str1=string(u+1:end);n=eval(str1);jieguo1=n/180*pi;m=cos(jieguo1);str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elseifstring(u)=='('str4=string(1:u);str1=string(u+1:end);n=eval(str1);jieguo1=n/180*pi;m=scos(jieguo1);str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elsejieguo1=eval(string);jieguo2=jieguo1/180*pi;jieguo=cos(jieguo2);set(handles.edit1,'string',jieguo);end%Executesonbuttonpressinpushbutton4.functionpushbutton4_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton4(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)string=get(handles.edit1,'string');k=find(string=='+'|string=='-'|string=='*'|string=='/'|string=='(');u=max(k);ifu>=2str4=string(1:u);str1=string(u+1:end);n=eval(str1);jieguo1=n/180*pi;m=tan(jieguo1);str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elseifstring(u)=='('str4=string(1:u);str1=string(u+1:end);n=eval(str1);jieguo1=n/180*pi;m=tan(jieguo1);str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elsejieguo1=eval(string);jieguo2=jieguo1/180*pi;jieguo=tan(jieguo2);set(handles.edit1,'string',jieguo);end%Executesonbuttonpressinpushbutton5.functionpushbutton5_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton5(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)str2=get(handles.edit1,'string');string=strcat(str2,'^');set(handles.edit1,'string',string);%Executesonbuttonpressinpushbutton6.functionpushbutton6_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton6(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)str1=get(handles.pushbutton6,'string');str2=get(handles.edit1,'string');string=strcat(str2,str1);set(handles.edit1,'string',string);%Executesonbuttonpressinpushbutton7.functionpushbutton7_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton7(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)str1=get(handles.pushbutton7,'string');str2=get(handles.edit1,'string');string=strcat(str2,str1);set(handles.edit1,'string',string);%Executesonbuttonpressinpushbutton8.functionpushbutton8_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton8(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)str1=get(handles.pushbutton8,'string');str2=get(handles.edit1,'string');string=strcat(str2,str1);set(handles.edit1,'string',string);%Executesonbuttonpressinpushbutton9.functionpushbutton9_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton9(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)str1=get(handles.pushbutton9,'string');str2=get(handles.edit1,'string');string=strcat(str2,str1);set(handles.edit1,'string',string);%Executesonbuttonpressinpushbutton10.functionpushbutton10_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton10(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)string=get(handles.edit1,'string');k=find(string=='+'|string=='-'|string=='*'|string=='/'|string=='(');u=max(k);ifu>=2str4=string(1:u);str1=string(u+1:end);n=eval(str1);switchfix(n)case{0}m=asin(n);string=m*180/pi;str2=num2str(string);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);otherwiseset(handles.edit1,'string','Error');endelseifstring(u)=='('str4=string(u);str1=string(u+1:end);n=eval(str1);switchfix(n)case{0}m=asin(n);string=m*180/pi;str2=num2str(string);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);otherwiseset(handles.edit1,'string','Error');endelsen=eval(string)switchfix(n)case{0}jieguo1=eval(string);jieguo2=asin(jieguo1);jieguo=jieguo2*180/pi;set(handles.edit1,'string',jieguo);otherwiseset(handles.edit1,'string','Error');endend%Executesonbuttonpressinpushbutton11.functionpushbutton11_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton11(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)string=get(handles.edit1,'string');k=find(string=='+'|string=='-'|string=='*'|string=='/'|string=='('|string=='(');u=max(k);ifu>=2str4=string(1:u);str1=string(u+1:end);n=eval(str1);ifn>1set(handles.edit1,'string','Error');elsejieguo2=acos(n);m=jieguo2*180/pi;str2=num2str(m);jirguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);endelseifstring(u)=='('str4=string(u);str1=string(u+1:end);n=eval(str1);ifn>1set(handles.edit1,'string','Error');elsejieguo2=acos(n);m=jieguo2*180/pi;str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);endelsen=eval(string);ifn>1set(handles.edit1,'string','Error');elsejieguo2=acos(n);jieguo=jieguo2*180/pi;set(handles.edit1,'string',jieguo);endend%Executesonbuttonpressinpushbutton12.functionpushbutton12_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton12(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)string=get(handles.edit1,'string');k=find(string=='+'|string=='-'|string=='*'|string=='/'|string=='(');u=max(k);ifu>=2str4=string(1:u);str1=string(u+1:end);n=eval(str1);jieguo2=atan(n);m=jieguo2*180/pi;str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elseifstring(u)=='('str4=string(u);str1=string(u+1:end);n=eval(str1);jieguo2=atan(n);m=jieguo2*180/pi;str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elsen=eval(string);jieguo2=atan(n);jieguo=jieguo2*180/pi;set(handles.edit1,'string',jieguo);end%Executesonbuttonpressinpushbutton13.functionpushbutton13_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton13(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)str1=get(handles.pushbutton13,'string');str2=get(handles.edit1,'string');string=strcat(str2,str1);set(handles.edit1,'string',string);%Executesonbuttonpressinpushbutton14.functionpushbutton14_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton14(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)str1=get(handles.pushbutton14,'string');str2=get(handles.edit1,'string');string=strcat(str2,str1);set(handles.edit1,'string',string);%Executesonbuttonpressinpushbutton15.functionpushbutton15_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton15(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)str1=get(handles.pushbutton15,'string');str2=get(handles.edit1,'string');string=strcat(str2,str1);set(handles.edit1,'string',string);%Executesonbuttonpressinpushbutton16.functionpushbutton16_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton16(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)str1=get(handles.pushbutton16,'string');str2=get(handles.edit1,'string');string=strcat(str2,str1);set(handles.edit1,'string',string);%Executesonbuttonpressinpushbutton17.functionpushbutton17_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton17(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)str1=get(handles.pushbutton17,'string');str2=get(handles.edit1,'string');string=strcat(str2,str1);set(handles.edit1,'string',string);%Executesonbuttonpressinpushbutton20.functionpushbutton20_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton20(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)string=get(handles.edit1,'string');k=find(string=='+'|string=='-'|string=='*'|string=='/'|string=='(');u=max(k);ifu>=2str4=string(1:u);str1=string(u+1:end);n=eval(str1);m=log(n);str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elseifstring(u)=='('str4=string(1:u);str1=string(u+1:end);n=eval(str1);m=log(n);str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elsejieguo1=eval(string);jieguo=log(jieguo1);set(handles.edit1,'string',jieguo);end%Executesonbuttonpressinpushbutton21.functionpushbutton21_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton21(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)string=get(handles.edit1,'string');k=find(string=='+'|string=='-'|string=='*'|string=='/'|string=='(');u=max(k);ifu>=2str4=string(1:u);str1=string(u+1:end);n=eval(str1);m=log10(n);str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elseifstring(u)=='('str4=string(u);str1=string(u+1:end);n=eval(str1);m=log10(n);str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elsejieguo1=eval(string);jieguo=log10(jieguo1);set(handles.edit1,'string',jieguo);end%Executesonbuttonpressinpushbutton22.functionpushbutton22_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton22(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)string=get(handles.edit1,'string');k=find(string=='+'|string=='-'|string=='*'|string=='/'|string=='(');u=max(k);ifu>=2str4=string(1:u);str1=string(u+1:end);n=eval(str1);m=n^2;str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elseifstring(u)=='('str4=string(1:u);str1=string(u+1:end);n=eval(str1);m=n^2;str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elsejieguo1=eval(string);jieguo=jieguo1^2;set(handles.edit1,'string',jieguo);end%Executesonbuttonpressinpushbutton23.functionpushbutton23_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton23(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)string=get(handles.edit1,'string');k=find(string=='+'|string=='-'|string=='*'|string=='/'|string=='(');u=max(k);ifu>=2str4=string(1:u);str1=string(u+1:end);n=eval(str1);m=n/100;str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elseifstring(u)=='('str4=string(1:u);str1=string(u+1:end);n=eval(str1);m=n/100;str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elsejieguo1=eval(string);jieguo=jieguo1/100;set(handles.edit1,'string',jieguo);end%Executesonbuttonpressinpushbutton24.functionpushbutton24_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton24(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)str1=get(handles.pushbutton24,'string');str2=get(handles.edit1,'string');string=strcat(str2,str1);set(handles.edit1,'string',string);%Executesonbuttonpressinpushbutton25.functionpushbutton25_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton25(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)str1=get(handles.pushbutton25,'string');str2=get(handles.edit1,'string');string=strcat(str2,str1);set(handles.edit1,'string',string);%Executesonbuttonpressinpushbutton26.functionpushbutton26_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton26(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)str1=get(handles.pushbutton26,'string');str2=get(handles.edit1,'string');string=strcat(str2,str1);set(handles.edit1,'string',string);%Executesonbuttonpressinpushbutton27.functionpushbutton27_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton27(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)str=get(handles.edit1,'string');string=strcat('-',str);set(handles.edit1,'string',string);%Executesonbuttonpressinpushbutton28.functionpushbutton28_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton28(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)string=get(handles.edit1,'string');k=find(string=='+'|string=='-'|string=='*'|string=='/'|string=='(');u=max(k);ifu>=2str4=string(1:u);str1=string(u+1:end);n=eval(str1);m=exp(n);str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elseifstring(u)=='('str4=string(1:u);str1=string(u+1:end);n=eval(str1);m=exp(n);str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elsejieguo1=eval(string);jieguo=exp(jieguo1);set(handles.edit1,'string',jieguo);end%Executesonbuttonpressinpushbutton29.functionpushbutton29_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton29(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)string=get(handles.edit1,'string');k=find(string=='+'|string=='-'|string=='*'|string=='/'|string=='(');u=max(k);ifu>=2str4=string(1:u);str1=string(u+1:end);n=eval(str1);m=10^n;str2=num2str(m);jieguo=strcat(str4,str2);set(handles.edit1,'string',jieguo);elseifstring(u)=='('str4=string(1:u);str1=string

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论