《MATLAB语言》上机实验报告 班级: 终极一班 学号:9527 姓名:小丢 set(handles.text1,'String',textString);
% --- Executes on button press in pushbutton9.
function pushbutton9_Callback(hObject, eventdata, handles) % hObject handle to pushbutton9 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text1,'String'); textString=strcat(textString,'8'); set(handles.text1,'String',textString);
% --- Executes on button press in pushbutton10.
function pushbutton10_Callback(hObject, eventdata, handles) % hObject handle to pushbutton10 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text1,'String'); textString=strcat(textString,'9'); set(handles.text1,'String',textString);
% --- Executes on button press in pushbutton11.
function pushbutton11_Callback(hObject, eventdata, handles) % hObject handle to pushbutton11 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text1,'String'); textString=strcat(textString,'+'); set(handles.text1,'String',textString);
% --- Executes on button press in pushbutton12.
function pushbutton12_Callback(hObject, eventdata, handles) % hObject handle to pushbutton12 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text1,'String'); textString=strcat(textString,'-');
set(handles.text1,'String',textString);
% --- Executes on button press in pushbutton13.
function pushbutton13_Callback(hObject, eventdata, handles) % hObject handle to pushbutton13 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text1,'String'); textString=strcat(textString,'*');
要求:只需给出程序,不要列出运行结果。
《MATLAB语言》上机实验报告 班级: 终极一班 学号:9527 姓名:小丢 set(handles.text1,'String',textString);
% --- Executes on button press in pushbutton14.
function pushbutton14_Callback(hObject, eventdata, handles) % hObject handle to pushbutton14 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text1,'String'); textString=strcat(textString,'/');
set(handles.text1,'String',textString);
% --- Executes on button press in pushbutton15.
function pushbutton15_Callback(hObject, eventdata, handles) % hObject handle to pushbutton15 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text1,'String'); textString=strcat(textString,'.');
set(handles.text1,'String',textString);
% --- Executes on button press in pushbutton16.
function pushbutton16_Callback(hObject, eventdata, handles) % hObject handle to pushbutton16 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text1,'String'); s=eval(textString);
set(handles.text1,'String',s);
% --- Executes on button press in pushbutton17.
function pushbutton17_Callback(hObject, eventdata, handles) % hObject handle to pushbutton17 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text1,'String'); textString=strcat(textString,'^2'); set(handles.text1,'String',textString);
% --- Executes on button press in pushbutton18.
function pushbutton18_Callback(hObject, eventdata, handles) % hObject handle to pushbutton18 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) textString=get(handles.text1,'String'); w=length(textString); t=char(textString); textString=t(1:w-1);
set(handles.text1,'String',textString);
要求:只需给出程序,不要列出运行结果。
《MATLAB语言》上机实验报告 班级: 终极一班 学号:9527 姓名:小丢 % --- Executes on button press in pushbutton19.
function pushbutton19_Callback(hObject, eventdata, handles) % hObject handle to pushbutton19 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) set(handles.text1,'String','');
% --- Executes on button press in pushbutton20.
function pushbutton20_Callback(hObject, eventdata, handles) % hObject handle to pushbutton20 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB % handles structure with handles and user data (see GUIDATA) close(gcf);
要求:只需给出程序,不要列出运行结果。
《MATLAB语言》上机实验报告 班级: 终极一班 学号:9527 姓名:小丢 实验14 高级图形用户界面设计(3)
1. 教材《MATLAB基础与实例进阶》P.169页,思考与练习2 操作题(5)
clc;clear all;close all;
h0=figure('NumberTitle','off','toolbar','none','position',[450 280 370 230],... 'Color',[1 0 0.8],'name','图形对象的创建实例'); %创建图形窗口 htext=uicontrol('Style','Text','String','画图区域','Units','normalized','FontSize',12,... 'Position',[0.5 0.85 0.2 0.1],'BackgroundColor',[0.7 0.8 1]); %创建文本对象 haxes=axes('Position',[0.3 0.1 0.6 0.7],'Box','on'); %创建坐标轴 t=0:0.01:6*pi;
hline=plot(t,sin(t)); %创建线条对象
hoption=uimenu('label','Option','Position',3); %创建菜单 hcolor=uimenu(hoption,'label','颜色'); %创建一级下拉菜单 hsubmenu1=uimenu(hcolor,'label','红色','Accelerator','r',... 'callback','set(hline,''color'',''r'');'); %创建二级下拉菜单 hsubmenu2=uimenu(hcolor,'label','绿色','Accelerator','g',... 'callback','set(hline,''color'',''g'');'); %创建二级下拉菜单 hgrid=uimenu(hoption,'label','网格线','Separator','on');
hsubmenu3=uimenu(hgrid,'label','Grid on','callback','grid on;'); hsubmenu4=uimenu(hgrid,'label','Grid off','callback','grid off;');
hpopupmenu=uicontrol('Style','popupmenu','String','正弦曲线|余弦曲线','Units','normalized',... 'pos',[0.03 0.7 0.21 0.1],'fontsize',10,'callback','hpopup'); hpushback=uicontrol('String','退出','Units','normalized',... 'pos',[0.03 0.1 0.15 0.1],'fontsize',10,'callback','close;');
%hpopup.m%
k=get(hpopupmenu,'Value'); switch k case 1
cla(haxes); t=0:0.01:6*pi; hline=plot(t,sin(t)); set(htext,'string','正弦曲线'); case 2
cla(haxes); t=0:0.01:6*pi; hline=plot(t,cos(t)); set(htext,'string','余弦曲线'); end
要求:只需给出程序,不要列出运行结果。
《MATLAB语言》上机实验报告 班级: 终极一班 学号:9527 姓名:小丢 实验15 Simulink仿真(1)
1.建立一简单的模型,用信号发生器产生一个幅度为2、频率为3Hz的锯齿波,再叠加一个幅度为2、频率为1Hz的连续正弦波。将叠加后的信号显示在示波器上。 要求:绘制模型图,并标注各模块的主要参数设置
要求:只需给出程序,不要列出运行结果。
《MATLAB语言》上机实验报告 班级: 终极一班 学号:9527 姓名:小丢 实验16 Simulink仿真(2)
1.使用Simulink的积分模块求解二阶微分方程
3x''?5x'?9x?5u(t),u(t)是阶跃函数。
要求:绘制模型图,并标注各模块的主要参数设置,输出示波器模块就
要求:只需给出程序,不要列出运行结果。
百度搜索“77cn”或“免费范文网”即可找到本站免费阅读全部范文。收藏本站方便下次阅读,免费范文网,提供经典小说综合文库MATLAB上机实验报告 - 基础与实例进阶(6)在线全文阅读。
相关推荐: