MATLAB上机实验报告 - 基础与实例进阶(6)

2020-04-16 10:22

《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)是阶跃函数。

要求:绘制模型图,并标注各模块的主要参数设置,输出示波器模块就

要求:只需给出程序,不要列出运行结果。


MATLAB上机实验报告 - 基础与实例进阶(6).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:沈阳市的城市布局现有的问题以及规划

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: