MATLAB上机实验报告-基础与实例进阶_第1页
MATLAB上机实验报告-基础与实例进阶_第2页
MATLAB上机实验报告-基础与实例进阶_第3页
MATLAB上机实验报告-基础与实例进阶_第4页
MATLAB上机实验报告-基础与实例进阶_第5页
已阅读5页,还剩21页未读 继续免费阅读

付费下载

下载本文档

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

文档简介

《MATLAB语言》上机实验报告班级:终极一班学号:9527姓名:小丢要求:只需给出程序,不要列出运行结果。实验1MATLAB初步1.举例说明format命令的功能;功能:设置显示浮点格式%n读取一个数字并转换为double%d读取一个数据并转换为int32%d8读取一个数据并转换为int8%d16读取一个数据并转换为int16%d32读取一个数据并转换为int32%d64读取一个数据并转换为int64%u读取一个数据并转换为uint32%u8读取一个数据并转换为uint8%u16读取一个数据并转换为uint16%u32读取一个数据并转换为uint32%u64读取一个数据并转换为uint64%f4读取一个数字并转换为double%f32读取一个数字并转换为float%f64读取一个数字并转换为double%s读取一个字符串%q读取一个可以是双引号括着的字符串%c读取一个字符,包括空格%[…]读取和括号中字符串相匹配的字符。读取操作在首次遇到不匹配的字符和空格时停止。例如%[mus]把summer读成summ%[^…]读取和括号中字符串不匹配的字符。读取操作在首次遇到不匹配的字符和空格时停止。例如%[^mus]把summer读成er2.说明clc,clf和clear命令的区别;clc:清除所有输入和从命令窗口显示输出clf:删除从当前图的所有图形对象clear:从当前删除所有变量工作空间,释放系统内存。3.举例说明help命令的功能;列出所有主要帮助主题在命令窗口。对应于每个主要帮助主题MATLAB搜索路径上一个文件夹的名字。4.如何观察和调用历史命令;通过命令历史窗口执行历史指令:1)用鼠标左键双击一条指令,即可自动将其发送到命令窗口并立即执行;2)选中一条指令,单击鼠标右键并选择copy菜单,再在命令窗口单击paste按钮即可。5.如何设置当前路径。1)选中Matlab快捷启动的图标,鼠标右键菜单选择“属性”;2)“起始位置”项目后面对应的路径就是启动之后的默认路径,修改成自己期望的路径,然后应用或确定。

实验2矩阵生成与元素标识1.矩阵的创建,(尽可能用最简单方法);A=[1300;26130;3523;4923]B=[151015;20253035;40455055;60657075]2.生成一个单位矩阵C,其结构与B相同;>>C=eye(size(B))C=10000100001000013.找出矩阵A中所有大于8的元素位置(行号和列号);>>[x,y]=find(A>8)x=24y=22将矩阵B中大于35且小于65的元素值分别加9;>>B(find(B>35&B<65))=B(find(B>35&B<65))+9B=151015202530354954596469657075提取矩阵B的主对角组元素。>>diag(B)ans=1255075

实验3MATLAB矩阵运算(1)1.矩阵的创建,;A=[1300;26130;3523;4923]B=[2-3995;2689;101176;-99-601]2.矩阵A和矩阵B相乘运算;>>A*Bans=81512332156393707577-2612535175-251464821163.求矩阵B的行列式、逆、秩、特征值和特征矢量(说明具体变量名);行列式:>>b=det(B)b=5.5092e+05逆:>>b1=inv(B)b1=0.00010.0081-0.0104-0.0110-0.0026-0.10220.15330.01340.0104-0.01280.01040.0010-0.00750.1888-0.1091-0.0074秩:>>b2=rank(B)b2=4特征矢量:>>b3=eig(B)b3=29.2415+29.4980i29.2415-29.4980i-32.7248-9.75834.将矩阵A和矩阵B纵向拼接,并将元素-99所在列乘以9;>>C=vertcat(A,B)C=130026130352349232-39952689101176-99-6011>>[x,y]=find(C==-99)x=8y=1>>C(:,y)=C(:,y)*9C=9300186130275233692318-399518689901176-891-601 实验4MATLAB矩阵运算(2)1.将矩阵A和矩阵B横向拼接,并提取合并后矩阵的主对角元素。>>D=cat(2,A,B)D=13002-399526130268935231011764923-99-601>>diag(D)ans=161232.求下列矩阵的列均值、列和、列方差、所有元素的平均值,,。>>A=[123;654;9910001050]>>B=[2-3995;2689;101176;-99-601]列和:>>sum(A)ans=10610071057>>sum(B)ans=-85811421均值:>>mean(A)ans=335.6667352.3333>>mean(B)ans=-21.25002.000028.50005.2500列方差:>>var(A)ans=1.0e+005*0.03053.31013.6505>>var(B)ans=1.0e+003*2.70090.06202.22170.0109所有元素的平均值:>>mean(mean(A))ans=241.1111>>mean(mean(B))ans=3.62503.已知5座城市的坐标分别为:(-201.1,-99.7)、(0,111.5)、(13..8,-69.7)、(91.8,29.7)、(26.9,-199.1)。用不同标记标出各城市,并用兰色虚线连接两两城市;然后根据城市间的两两距离,寻找距离最短的两座城市,并用红色点划线连接。d=[-201.1-99.7;0111.5;13.8-69.7;91.829.7;26.9-199.1];plot(d(1,1),d(1,2),'*');holdon;plot(d(2,1),d(2,2),'+');plot(d(3,1),d(3,2),'o');plot(d(4,1),d(4,2),'s');plot(d(5,1),d(5,2),'d');flag=[];dist=1000000;fori=1:4forj=i+1:5x=[d(i,1)d(j,1)];y=[d(i,2)d(j,2)];plot(x,y,'--')d1=sqrt((x(1)-x(2))^2+(y(1)-y(2))^2);ifd1<distdist=d1;flag=[ij];endendendplot(d(flag,1),d(flag,2),'-.r');实验5MATLAB矩阵运算(3)求下列矩阵的列均值、列和、列方差、所有元素的平均值,,。5、已知5座城市的坐标分别为:(-201.1,-99.7)、(0,111.5)、(13..8,-69.7)、(91.8,29.7)、(26.9,-199.1)。用不同标记标出各城市,并用兰色虚线连接两两城市;然后根据城市间的两两距离,寻找距离最短的两座城市,并用红色点划线连接。

实验6MATLAB绘图(1)试绘制,式中;y=x^3:clear;clc;x=-2*pi:pi/180:2*pi;plot(x.^3,'r');gridon;y=x^2:clear;clc;x=-2*pi:pi/180:2*pi;plot(x.^2,'g');gridon;y=sin(x):clear;clc;x=-2*pi:pi/180:2*pi;plot(sin(x),'b');gridon;试绘制;clear;clc;x=-5:0.1:5;y=x;z=1./(((1-x).^2+y.^2).^0.5);plot(z);生成一个周期为2π,占空比为0.3的方波;clear;clc;t=0:pi/180:10*pi;y=square(t,30);plot(t,y);gridylim([-1.51.5])绘制y的杆状图。clear;clc;x=0:pi/10:10*pi;y=exp(-0.4.*x).*cos(x)plot(y);stem(x,y)5、已知5座城市的坐标分别为:(-201.1,-99.7)、(0,111.5)、(13..8,-69.7)、(91.8,29.7)、(26.9,-199.1),用不同标记标出各城市,并用兰色虚线连接两两城市。

实验7MATLAB绘图(2)编写程序产生如下信号,并按要求绘制相应的曲线。利用save

as命令把图形分别保存成.fig格式和.jpg格式的图像文件。

(1)信号形式y=sin(2x+pi/4),利用plot命令绘制该信号在0<=x<+2pi区间内,且采样间隔为pi/1000的曲线。填加网格线,标题为“正弦信号曲线”,横坐标显示“x”,纵坐标显示“y”。

clc;clear;x=0:pi/1000:2*pi;y=sin(2.*x+pi/4);plot(y);grid;title('正弦信号曲线');xlabel('x');ylabel('y');saveas(gcf,'a.jpg');saveas(gcf,'a.fig');(2)将上述信号左平移或右平移2得到两个新信号y2和y3,利用hold命令在同一图中显示三条曲线并通过线型和颜色加以区分。

clc;clear;x=0:pi/1000:2*pi;y=sin(2.*x+pi/4);y2=sin(2.*x+pi/4+2);y3=sin(2.*x+pi/4-2);plot(y);holdon;plot(y2,'g');plot(y3,'r');grid;title('正弦信号曲线');xlabel('x');ylabel('y');saveas(gcf,'a.jpg');saveas(gcf,'a.fig');(3)利用subplot命令将上述三个信号利用子图来显示;利用figure命令将上述三个信号分别在不同的窗体中同时显示。

Subplot:clc;clear;x=0:pi/1000:2*pi;y=sin(2.*x+pi/4);y2=sin(2.*x+pi/4+2);y3=sin(2.*x+pi/4-2);subplot(3,1,1);plot(y);holdon;subplot(3,1,2);plot(y2,'g');subplot(3,1,3);plot(y3,'r');grid;title('');xlabel('x');ylabel('y');saveas(gcf,'a.jpg');saveas(gcf,'a.fig');figure:clc;clear;x=0:pi/1000:2*pi;y=sin(2.*x+pi/4);y2=sin(2.*x+pi/4+2);y3=sin(2.*x+pi/4-2);figure;plot(y);grid;holdon;figure;plot(y2,'g');grid;figure;plot(y3,'r');grid;title('');xlabel('x');ylabel('y');saveas(gcf,'a.jpg');saveas(gcf,'a.fig');(4)z

=

0:0.1:40;x

=

cos(z);y

=

sin(z),利用plot3命令绘制三维曲线并填加相应的坐标轴标注。clc;clear;z=0:0.1:40;x=cos(z);y=sin(z);plot3(x,y,z);xlabel('x');ylabel('y');zlabel('z');saveas(gcf,'a.jpg');saveas(gcf,'a.fig');实验8MATLAB序设计(1)分别用for和while循环语句编写程序,求出;for:clc;clear;s=0;forn=1:10s=s+5^n;endss=12207030clc;clear;s=0;n=1;whilen<=10s=s+5^n;n=n+1;endss=12207030试不用循环语句,改用MATLAB的矩阵函数求解1题。clc;clear;n=1:10;s=5.^n;sum(s)ans=122070303.编写一个函数文件testfun:对于任意整数,若大于0,则返回该数的余弦值,否则返回其绝对值。并将实整数-66代入求此函数的运行结果。functiontestfun(x)if(x>0)y=cos(x);elsey=abs(x);endy>>testfun(-66)y=664.输入x,y的值,并将它们的值互换后输出。functionchange(x,y)a=x;x=y;y=a;xy>>x=2;>>y=1;>>change(x,y)x=1y=25.利用rand产生10个随机数,利用for循环对其进行排序(从大到小)。A=rand(1,10);temp=1;while(temp==1)temp=0;forn=1:9;if(A(1,n)<A(1,n+1))t=A(1,n);A(1,n)=A(1,n+1);A(1,n+1)=t;temp=1;endendendAA=Columns1through40.78470.77020.72180.4714Columns5through80.46240.46090.42430.3225Columns9through100.17590.0358实验9MATLAB序设计(2)1.编写一个M函数文件计算下列级数的和:x和n的值由input指令给出。functionf=testx=input('Inputthex:\n');n=input('Inputthen:\n');j=1;f2=0;fori=1:n;j=1;fork=1:i;j=j*k;f1=x^i/j;endf2=f2+f1;endf=f2+1;>>testInputthex:12Inputthen:12ans=9.3741e+042.编制m文件,等待键盘输入,输入密码123,密码正确,显示输入密码正确,程序结束;否则提示,重新输入。functiontestn=0;k=0;n=input('请输入密码(整数)\n');while(k==0)ifn==123disp('密码正确')k=1;elsek=0;n=input('密码错误,请重新输入密码(整数)\n');endend>>test请输入密码(整数)124密码错误,请重新输入密码(整数)124密码错误,请重新输入密码(整数)123输入正确3.编制m文件,输入n(正整数),显示所有小于n的质数。functionleap=panduan(n)leap=1;fori=2:sqrt(n+1)ifmod(n,i)==0leap=0;break;endendfunctionzhishu(n)form=2:nifpanduan(m)==1disp(m);endend>>zhishu(15)235711134.数组[1:99]中素数(即质数)元素的和functionleap=panduan(n)leap=1;fori=2:sqrt(n+1)ifmod(n,i)==0leap=0;break;endendfunctionsum1k=0;form=1:99ifpanduan(m)==1k=k+m;endendk>>sum1k=10615.从键盘输入若干个数,当输入0时结束输入,求这些数的平均值以及平方和。functioncals=0;n=0;s2=0;temp=input('');while(temp~=0)s=s+temp;s2=s2+temp.^2;n=n+1;temp=input('');ends./ns2cal1234567890ans=5s2=285

实验10MATLAB数据文件I/O(1)1.教材《MATLAB基础与实例进阶》P.111页,思考与练习2操作题(1)-(2)(1)将工作目录下的后缀为‘.dat’的文件更改为‘.bin'作为后缀。filename1='mydata.dat';fid1=fopen(filename1,'r');a=fread(fid1)filename2='mydata.bin';fid2=fopen(filename2,'r');fwrite(fid2,a);b=fread(fid2)(2)使用MATLAB导入一个WAVE格式的音频文件,并比较与waveread函数读取音频文件的差异。用waveread函数读取音频文件时:[y,fs,nbits]=wavread(file),file指定音频文件名,y是音频数据。另外该语句还能够返回该音频文件的采样率fs,和采样位数nbits,而使用MATLAB导入WAVE格式的音频文件,是不能控制音频文件的采样率,不能够精确调整。

实验11MATLAB数据文件I/O(2)教材《MATLAB基础与实例进阶》P.111页,思考与练习2操作题(3)-(4)读取例4-8中最后两列数据。fid=fopen('my.bin','w');alldata=reshape([1:20],4,5);fwrite(fid,alldata);fid=fopen('my.bin');fseek(fid,12,'bof');last_two=fread(fid,[4,2])fclose(fid);使用textread函数读出例4-12中的所有浮点数,要求小数点后只有一位数。clc;clearall;closeall;[names,rest]=textread('mytextfile.txt','%s%[^\n]','delimiter',',');a1=str2num(rest{1});a2=str2num(rest{2});a3=str2num(rest{3});a4=str2num(rest{4});b=[a1(3),a2(3),a3(3),a4(3)];fprintf('%4.1

实验12高级图形用户界面设计(1)教材《MATLAB基础与实例进阶》P.169页,思考与练习2操作题(1)-(2)(1)建立一个图形窗口,使之背景颜色为红色,并在窗口上保留原有的菜单项,而且在按下鼠标器的左键之后显示Left

Button

Pressed字样。h0=figure('Color',[1,0,0],'Name','图形窗口','Numbertitle','off','WindowButtonDownFcn','text(0.35,0.5,''LeftButtonPressed'')','toolbar','none');(2)利用图形对象绘制下列曲线,要求先用默认属性创建线条对象,再通过句柄操作改变曲线颜色、线型和线宽,并利用文本对象给曲线添加标注。clc;clearall;closeall;x1=0:.001:1;y1=(1+x1.^2)/(1+x1.^4);subplot(311)hline1=plot(x1,y1)x2=0:pi/100:2*pi;y2=3*x2+sin(x2)-exp(x2);subplot(312)hline2=plot(x2,y2)x3=-1000:1:1000;y3=log(x3+sqrt(1+x3.^2))/2;subplot(313)hline3=plot(x3,y3)set(hline1,'color','r','linestyle','-','linewidth',0.5);set(hline2,'color','g','linestyle','+','linewidth',0.5);set(hline3,'color','b','linestyle','.','linewidth',0.5);gtext('y=(1+x^2)/(1+x^4);');gtext('y=3*x+sin(x)-exp(x)');gtext('y=log(x+sqrt(1+x^2))/2');实验13高级图形用户界面设计(2)1.教材《MATLAB基础与实例进阶》P.169页,思考与练习2操作题(3)-(4)(3)在一个图形窗口中创建两坐标轴用以显示不同图形,并创建快捷菜单以改变曲线颜色clc;clearall;closeall;h0=figure('toolbar','none','menubar','none','position',[380200500350],...'name','控件的综合应用');%创建图形窗口h_axes1=axes('Position',[0.070.080.40.45],'box','on');%创建坐标轴h_axes2=axes('Position',[0.550.430.420.45],'box','on');%创建坐标轴%在第一个坐标轴上画图t=0:0.01:6*pi;yy=cos(t);b=1/2/pi;h_line=plot(h_axes1,t,yy,'LineWidth',2);axis([-0.520-1.21.2]);%在第二个坐标轴上画图t=0:0.01:6*pi;yy=sin(t);b=1/2/pi;h_line2=plot(h_axes2,t,yy,'LineWidth',2);axis([-0.520-1.21.2]);h_menu1=uimenu('label','颜色1');%创建菜单h_submenu11=uimenu(h_menu1,'label','红色','callback',...'axes(h_axes2);set(h_line,''color'',''r'');');h_submenu12=uimenu(h_menu1,'label','绿色','callback',...'axes(h_axes2);set(h_line,''color'',''g'');');h_submenu13=uimenu(h_menu1,'label','黑色','callback',...'axes(h_axes2);set(h_line,''color'',''k'');');h_submenu14=uimenu(h_menu1,'label','紫红色','callback',...'axes(h_axes2);set(h_line,''color'',''m'');');h_submenu15=uimenu(h_menu1,'label','黄色','callback',...'axes(h_axes2);set(h_line,''color'',''y'');');h_menu2=uimenu('label','颜色2');%创建菜单h_submenu21=uimenu(h_menu2,'label','红色','callback',...'axes(h_axes2);set(h_line2,''color'',''r'');');h_submenu22=uimenu(h_menu2,'label','绿色','callback',...'axes(h_axes2);set(h_line2,''color'',''g'');');h_submenu23=uimenu(h_menu2,'label','黑色','callback',...'axes(h_axes2);set(h_line2,''color'',''k'');');h_submenu24=uimenu(h_menu2,'label','紫红色','callback',...'axes(h_axes2);set(h_line2,''color'',''m'');');h_submenu25=uimenu(h_menu2,'label','黄色','callback',...'axes(h_axes2);set(h_line2,''color'',''y'');');h_menu3=uimenu('label','关闭图形窗口','callback','close(h0);');%创建菜单(4)设计一个计算器,实现简单的加、减、乘、除运算functionvarargout=work(varargin)%WORKM-fileforwork.fig%WORK,byitself,createsanewWORKorraisestheexisting%singleton*.%%H=WORKreturnsthehandletoanewWORKorthehandleto%theexistingsingleton*.%%WORK('CALLBACK',hObject,eventData,handles,...)callsthelocal%functionnamedCALLBACKinWORK.Mwiththegiveninputarguments.%%WORK('Property','Value',...)createsanewWORKorraisesthe%existingsingleton*.Startingfromtheleft,propertyvaluepairsare%appliedtotheGUIbeforework_OpeningFunctiongetscalled.An%unrecognizedpropertynameorinvalidvaluemakespropertyapplication%stop.Allinputsarepassedtowork_OpeningFcnviavarargin.%%*SeeGUIOptionsonGUIDE'sToolsmenu.Choose"GUIallowsonlyone%instancetorun(singleton)".%%Seealso:GUIDE,GUIDATA,GUIHANDLES%Edittheabovetexttomodifytheresponsetohelpwork%LastModifiedbyGUIDEv2.517-Dec-201311:40:56%Begininitializationcode-DONOTEDITgui_Singleton=1;gui_State=struct('gui_Name',mfilename,...'gui_Singleton',gui_Singleton,...'gui_OpeningFcn',@work_OpeningFcn,...'gui_OutputFcn',@work_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%---Executesjustbeforeworkismadevisible.functionwork_OpeningFcn(hObject,eventdata,handles,varargin)%Thisfunctionhasnooutputargs,seeOutputFcn.%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%varargincommandlineargumentstowork(seeVARARGIN)%Choosedefaultcommandlineoutputforworkhandles.output=hObject;%Updatehandlesstructureguidata(hObject,handles);%UIWAITmakesworkwaitforuserresponse(seeUIRESUME)%uiwait(handles.figure1);%---Outputsfromthisfunctionarereturnedtothecommandline.functionvarargout=work_OutputFcn(hObject,eventdata,handles)%varargoutcellarrayforreturningoutputargs(seeVARARGOUT);%hObjecthandletofigure%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)%Getdefaultcommandlineoutputfromhandlesstructurevarargout{1}=handles.output;%---Executesonbuttonpressinpushbutton1.functionpushbutton1_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton1(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');textString=strcat(textString,'0');set(handles.text1,'String',textString);%---Executesonbuttonpressinpushbutton2.functionpushbutton2_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton2(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');textString=strcat(textString,'1');set(handles.text1,'String',textString);%---Executesonbuttonpressinpushbutton3.functionpushbutton3_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton3(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');textString=strcat(textString,'2');set(handles.text1,'String',textString);%---Executesonbuttonpressinpushbutton4.functionpushbutton4_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton4(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');textString=strcat(textString,'3');set(handles.text1,'String',textString);%---Executesonbuttonpressinpushbutton5.functionpushbutton5_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton5(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');textString=strcat(textString,'4');set(handles.text1,'String',textString);%---Executesonbuttonpressinpushbutton6.functionpushbutton6_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton6(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');textString=strcat(textString,'5');set(handles.text1,'String',textString);%---Executesonbuttonpressinpushbutton7.functionpushbutton7_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton7(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');textString=strcat(textString,'6');set(handles.text1,'String',textString);%---Executesonbuttonpressinpushbutton8.functionpushbutton8_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton8(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');textString=strcat(textString,'7');set(handles.text1,'String',textString);%---Executesonbuttonpressinpushbutton9.functionpushbutton9_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton9(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');textString=strcat(textString,'8');set(handles.text1,'String',textString);%---Executesonbuttonpressinpushbutton10.functionpushbutton10_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton10(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');textString=strcat(textString,'9');set(handles.text1,'String',textString);%---Executesonbuttonpressinpushbutton11.functionpushbutton11_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton11(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');textString=strcat(textString,'+');set(handles.text1,'String',textString);%---Executesonbuttonpressinpushbutton12.functionpushbutton12_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton12(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');textString=strcat(textString,'-');set(handles.text1,'String',textString);%---Executesonbuttonpressinpushbutton13.functionpushbutton13_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton13(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');textString=strcat(textString,'*');set(handles.text1,'String',textString);%---Executesonbuttonpressinpushbutton14.functionpushbutton14_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton14(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');textString=strcat(textString,'/');set(handles.text1,'String',textString);%---Executesonbuttonpressinpushbutton15.functionpushbutton15_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton15(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');textString=strcat(textString,'.');set(handles.text1,'String',textString);%---Executesonbuttonpressinpushbutton16.functionpushbutton16_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton16(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');s=eval(textString);set(handles.text1,'String',s);%---Executesonbuttonpressinpushbutton17.functionpushbutton17_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton17(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');textString=strcat(textString,'^2');set(handles.text1,'String',textString);%---Executesonbuttonpressinpushbutton18.functionpushbutton18_Callback(hObject,eventdata,handles)%hObjecthandletopushbutton18(seeGCBO)%eventdatareserved-tobedefinedinafutureversionofMATLAB%handlesstructurewithhandlesanduserdata(seeGUIDATA)textString=get(handles.text1,'String');w=length(textString);t=char(textString);textString=t(1:w-1);set(handles.text1,'Str

温馨提示

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

评论

0/150

提交评论