matlab課程設(shè)計(jì)修改最終版_第1頁
matlab課程設(shè)計(jì)修改最終版_第2頁
matlab課程設(shè)計(jì)修改最終版_第3頁
matlab課程設(shè)計(jì)修改最終版_第4頁
matlab課程設(shè)計(jì)修改最終版_第5頁
已閱讀5頁,還剩36頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

PAGE1課程設(shè)計(jì)報(bào)告(2011--2012年度第2學(xué)期)名稱:MATLAB課程設(shè)計(jì)與應(yīng)用題目:計(jì)算器界面設(shè)計(jì)及運(yùn)算實(shí)現(xiàn)院系:理學(xué)院班級:10統(tǒng)計(jì)1指導(dǎo)教師:陳華老師設(shè)計(jì)周數(shù):一周小組成員姓名學(xué)號:馮文鐸1011112105劉思1011112125董寬1011112113李鵬飛1011112119日期:2012年6月6日目錄課程設(shè)計(jì)目的……………………2課程設(shè)計(jì)任務(wù)……………………2GUI設(shè)計(jì)過程……………………23.1新建GUI設(shè)計(jì)窗口…………23.2GUI設(shè)計(jì)窗口操作……………33.3GUI窗口的實(shí)現(xiàn)………………44.函數(shù)命令設(shè)計(jì)過程………………95.不足之處…………126.總結(jié)………………127.參考文獻(xiàn)…………138.附件………………13科學(xué)計(jì)算器對話框設(shè)計(jì)及運(yùn)算實(shí)現(xiàn)課程設(shè)計(jì)目的MATLAB是一種以數(shù)值計(jì)算和數(shù)據(jù)圖示為主的計(jì)算機(jī)軟件,并包含適應(yīng)多個(gè)學(xué)科的專業(yè)軟件包,以及完善程序開發(fā)功能。進(jìn)行此課程設(shè)計(jì)旨在悉MATLAB的功能,掌握MATLAB程序設(shè)計(jì)和GUI設(shè)計(jì)的方法,在實(shí)際的操作中鞏固學(xué)習(xí)內(nèi)容。課程設(shè)計(jì)任務(wù)此課程設(shè)計(jì),要使用MATLAB軟件進(jìn)行操作,通過圖形用戶界面GUI設(shè)計(jì)窗口,操作GUI設(shè)計(jì)窗口左邊的控件工具欄,產(chǎn)生界面中我們需要的科學(xué)計(jì)算器的相關(guān)按鈕,在對象屬性查看器中進(jìn)行相應(yīng)的設(shè)置。GUI設(shè)計(jì)過程3.1新建GUI設(shè)計(jì)窗口打開matlab選file〉new>GUI>BlankGUI(default)得到了下面的設(shè)計(jì)窗口3.2GUI設(shè)計(jì)窗口操作(科學(xué)計(jì)算器所需的按鈕產(chǎn)生與設(shè)置)點(diǎn)擊ok鍵在窗口中產(chǎn)生pushbutton鍵,安放需要設(shè)定的科學(xué)計(jì)算器所需的按鍵的位置。然后在點(diǎn)擊edit后在窗口中上處點(diǎn)住拉到符合要求的大小,用PropertyInspector的設(shè)置把顯示結(jié)果的窗口的字符清空得到如下圖型:然后對每個(gè)pushbutton鍵進(jìn)行設(shè)置,雙擊后產(chǎn)生的對象屬性查看器中,string設(shè)置每個(gè)按鈕的名稱,分別為‘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個(gè)鍵。在我們用GUI時(shí)為了美觀我們用PropertyInspector的設(shè)置把按鍵設(shè)置為深藍(lán)色的,把按鍵上的字符設(shè)置為白色,把函數(shù)‘sin、sin-1、ln、e^x、cos、cos-1、log、10^x、tan、tan-1、x^2、x^1/2、y^x、1/x、%、(、)’的按鍵的大小設(shè)置為hight為2,width為6,而‘AC,DEL,=,1,2,3,4,5,6,7,8,9,0,-,+,*,/,+/-,.’按鍵hight為2,width為8,并且‘AC’和‘DEL’按鍵的顏色設(shè)為紅色,而‘=’按鍵設(shè)為青綠色后得到如下圖型:3.3GUI窗口的實(shí)現(xiàn)(科學(xué)計(jì)算器的功能實(shí)現(xiàn))在GUI窗口中已經(jīng)產(chǎn)生了一個(gè)符合要求的科學(xué)計(jì)算器的界面,為了使計(jì)算器實(shí)現(xiàn)其運(yùn)算功能,需要對每個(gè)按鈕的實(shí)現(xiàn)進(jìn)行編程。3.3.1首先打開M-fileEditor文件,在functionuntitled50_OpeningFcn(hObject,eventdata,handles,varargin)handles.output=hObject;%Updatehandlesstructureguidata(hObject,handles);的后面添加set(handles.figure1,'Name','科學(xué)計(jì)算器');%是把標(biāo)題變?yōu)椤茖W(xué)計(jì)算器’set(handles.edit1,'string','');%是把計(jì)算器的顯示器清空然后運(yùn)行就得到了如下圖:(在左上角由‘untitled50.fig’變?yōu)椤茖W(xué)計(jì)算器’了)3.3.2接下來對數(shù)字按鍵進(jìn)行編程如‘7’:選中‘7’鍵,鼠標(biāo)右擊選中viewcallbacks再選中callback點(diǎn)擊后在functionpushbutton6_Callback(hObject,eventdata,handles)后面加str1=get(handles.pushbutton6,'string');%得到結(jié)果顯示器的字符str2=get(handles.edit1,'string');%得到按鍵‘7’的字符string=strcat(str2,str1);%把兩個(gè)字符串合并set(handles.edit1,'string',string);%把合并后的字符串重新付給edit,作為結(jié)果顯示器的字符而按鍵‘1,2,3,4,5,6,8,9,0,-,+,*,/,+/-,.,(,)’同按鍵‘7’的步驟一樣。其實(shí)'y^x'按鍵和'7'按鍵也一致,只是得到按鍵字符串時(shí)'^'。3.3.3接下來是‘sin,cos,tan’函數(shù)的程序編制,如函數(shù)'sin':選中‘sin’鍵,鼠標(biāo)右擊選中viewcallbacks再選中callback點(diǎn)擊后在functionpushbutton2_Callback(hObject,eventdata,handles)后面加string=get(handles.edit1,'string');%得到結(jié)果顯示器edit的字符k=find(string=='+'|string=='-'|string=='*'|string=='/'|string=='(');%得到'+,-,*,/'的位置u=max(k);%得到k的最大值ifu>=2str4=string(1:u);%得到字符串'string'的1到u個(gè)字符str1=string(u+1:end);%得到字符串'string'的u以后的幾個(gè)字符n=eval(str1);%計(jì)算字符串'str1'所對應(yīng)的結(jié)果jieguo1=n/180*pi;%把n變?yōu)槎嗌佴衜=sin(jieguo1);%得出正弦值str2=num2str(m);%把m變?yōu)樽址蚸ieguo=strcat(str4,str2);%把str4和str2合并為jieguoset(handles.edit1,'string',jieguo);%把合并后的字符串重新付給edit,作為結(jié)果顯示器的字符elseifstring(u)=='('%如果k的最大位置上是'('str4=string(u);%把string的第u個(gè)字符給str4str1=string(u+1:end);%把string的第U+1到最后一個(gè)字符給str1n=eval(str1); %計(jì)算出str1的值給njieguo1=n/180*pi; %把n變?yōu)槎嗌佴衜=sin(jieguo1);%得出正弦值str2=num2str(m);%把m變?yōu)樽址蚸ieguo=strcat(str4,str2);%把str4和str2合并為jieguoset(handles.edit1,'string',jieguo);%把合并后的字符串重新付給edit,作為結(jié)果顯示器的字符else%如果第一個(gè)字符就是數(shù)字jieguo1=eval(string);%計(jì)算出string的值給jieguojieguo2=jieguo1/180*pi;%把jieguo變?yōu)槎嗌佴衘ieguo=sin(jieguo2);%得出正弦值set(handles.edit1,'string',jieguo);%把合并后的字符串重新付給edit,作為結(jié)果顯示器的字符end而按鍵'cos,tan'同按鍵'sin'的大致一樣。而'cos,tan,sin-1,cos-1,tan-1'按鍵也大致一樣,只是'tan-1'中的值可以大于1,而'sin-1,cos-1'中的值要小于1。其實(shí)'1/x,ln,log,x^2,%,e^x,10^x,x^1/2'都大致一樣,只是在其中添加了各自所需計(jì)算的函數(shù)程序而已。3.3.4接下來是‘AC,DEL,=’函數(shù)的程序編制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變?yōu)樽址蚻=length(ss);%得到ss的字符長度set(handles.edit1,'string',ss(1:l-1));%把ss的1到l-1個(gè)字符給顯示器edit,即刪除最后一個(gè)字符。=按鍵:在functionpushbutton38_Callback(hObject,eventdata,handles)后添加string=get(handles.edit1,'string');%得到顯示器edit的字符串jieguo=eval(string);%計(jì)算string的值set(handles.edit1,'string',jieguo);%把計(jì)算值給edit,作為結(jié)果顯示器的字符。最后運(yùn)行后就得到如下界面:(可以運(yùn)算)函數(shù)命令設(shè)計(jì)過程打開file-M-file輸入hf=figure('Color',[1,1,1],'Position',[100,200,600,450],...'Name','科學(xué)計(jì)算器','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');然后運(yùn)行得到如下界面:可以看出一共有36個(gè)按鍵,就有36個(gè)’call’,在M-file中編寫36個(gè)M-file函數(shù),如: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中,在科學(xué)計(jì)算器運(yùn)行時(shí),當(dāng)點(diǎn)擊到’sin’按鍵時(shí)就會調(diào)用m1.m中的函數(shù),其他按鍵以此類推一共有m1.m到m36.m,函數(shù)程序和GUI設(shè)計(jì)函數(shù)程序大致相同,在此不一一列舉了。5.不足之處在清屏后不能再顯示器edit中顯示‘0.’。沒有做到更人性化,還是有點(diǎn)不美觀。在函數(shù)命令設(shè)計(jì)中我們不能把界面做的和GUI設(shè)計(jì)的一致,如按鍵上的字符串的字體顏色,按鍵顏色等。(四)函數(shù)命令程序太過繁瑣。(五)實(shí)現(xiàn)科學(xué)計(jì)算器的功能太少。6.總結(jié)此次的課程實(shí)際,是針對MTLAB課程進(jìn)行的,在平時(shí)的學(xué)習(xí)當(dāng)中,我們了解了軟件所具有的很多功能。在不斷的操作中熟悉所了解的知識,每次的上機(jī)實(shí)驗(yàn)是實(shí)踐的主要部分。通過這次設(shè)計(jì),再次在實(shí)踐中學(xué)習(xí)。團(tuán)隊(duì)合作,運(yùn)用自身的優(yōu)勢,發(fā)揮合作的功效,很順利的完成了這次實(shí)踐作業(yè)。首先,我們對設(shè)計(jì)的界面進(jìn)行了選擇,一致決定設(shè)計(jì)科學(xué)計(jì)算器的界面,便順利的進(jìn)行了GUI界面的設(shè)計(jì)。對于科學(xué)計(jì)算器功能的實(shí)習(xí),需要加以編程。編程是一個(gè)比較復(fù)雜也相對其他部分,有一定的難度。經(jīng)過學(xué)習(xí),花費(fèi)了一定的時(shí)間,最終也得到了實(shí)現(xiàn)。之后,對于此設(shè)計(jì)界面功能實(shí)現(xiàn)是否可行,我們進(jìn)行了多次的檢驗(yàn),沒有計(jì)算的問題。我們在學(xué)習(xí)和設(shè)計(jì)的過程中,總結(jié)發(fā)現(xiàn),很多實(shí)際問題在對課本知識的學(xué)習(xí)當(dāng)中并不能完全的發(fā)掘與體現(xiàn),只有在實(shí)踐中,通過自身反復(fù)的嘗試操作,才能發(fā)現(xiàn)一些問題并很好的解決問題。也正是通過了認(rèn)真的學(xué)習(xí),才使得實(shí)踐設(shè)計(jì)過程沒那么多的困難,從中獲益良多。更發(fā)現(xiàn)了MATLAB此軟件功能的強(qiáng)大,與運(yùn)用的有利之處。參考文獻(xiàn)【1】劉衛(wèi)國編《MATBLE程序設(shè)計(jì)與應(yīng)用》高等教育出版社2006版【2】張圣勤編《MATABLE7.0實(shí)用教程》機(jī)械工業(yè)出版社2006版【3】劉金琨.先進(jìn)PID控制與MATLAB仿真[M].北京:電子工業(yè)出版社,2003.1.TP273/L587.2【4】劉金琨.滑模變結(jié)構(gòu)控制與MATLAB仿真北京清華大學(xué)出版社,2005.10.TP273/L587.2-28.附件GUI設(shè)計(jì)程序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','科學(xué)計(jì)算器');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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

最新文檔

評論

0/150

提交評論