实验6图形用户界面设计.doc

上传人:scccc 文档编号:13058849 上传时间:2021-12-13 格式:DOC 页数:6 大小:397.50KB
返回 下载 相关 举报
实验6图形用户界面设计.doc_第1页
第1页 / 共6页
实验6图形用户界面设计.doc_第2页
第2页 / 共6页
实验6图形用户界面设计.doc_第3页
第3页 / 共6页
实验6图形用户界面设计.doc_第4页
第4页 / 共6页
实验6图形用户界面设计.doc_第5页
第5页 / 共6页
点击查看更多>>
资源描述

《实验6图形用户界面设计.doc》由会员分享,可在线阅读,更多相关《实验6图形用户界面设计.doc(6页珍藏版)》请在三一文库上搜索。

1、实验6实验6.图形用户界面设计一、实验目的1. 掌握图形对象属性的基本操作;2. 掌握菜单及对话框设计、建立控件对象的方法。二、实验环境1. 计算机2. matlab7.1三、实验说明1. 正确操作,认真观察;2. 实验学时:2学时;3. 学会使用help ;4. 保存整理实验结果,提交实验报告。四、实验内容1. 设计如教材P374图1所示的菜单,并在此基础上增加选项:可以改变曲线的 颜色,可以改变窗口背景颜色。2. (选做)采用图形用户界面,从键盘输入参数a、b、n的值,考察参数对极坐标曲线二acos(b nR的影响。五、实验程序及结果1. scree n=get(O, 'Scree

2、 nSize' );W=scree n( 3);H=scree n( 4);figure( 'Color' , 'w' , 'Position',0.2*H,0.2*H,0.5*W,0.3*H,.'Name', 菜单设计实验,NumberTitle', 'off' , 'MenuBar' ,none');hplot=uime nu(gcf,'Label' ,'&Plot' );%定义 plot 菜单项uimenu(hplot,'

3、Label', 'Sine Wave', 'Call' ,.'t=-pi:pi/20:pi;',hO=plot(t,sin(t);',.'set(hlr,''E nable","o n'');''set(hlg,"E nable"," on'');');uime nu(hplot,'Label', 'Cosine Wave','Call''set(

4、hlb,''E nable"," on'');'3实验6't=-pi:pi/20:pi;', 'hO=plot(t,cos(t);''set(hlr,''Enable'',''on'');',.uime nu(hw,'Label','&Red','Ca ll','set(gcf,''Color'',''r'

5、');'uime nu(hw,'Label','&Gree n','Call','set(gcf,''Color'',''g'');'uime nu(hw,'Label','&Blue','Call','set(gcf,''Color'',''b'');'hl=uime nu(hc,'Label'

6、;,'&Line Color','Separator', 'on'););););hlr=uime nu(hl,'Label''set(h0,''Color'',''r'');' hlg=uime nu(hl,'Label''set(h0,''Color'',''g'');' hlb=uime nu(hl,'Label''se

7、t(hO,''Color'',''b'');''&Red' , 'Call',.,'off','Enable''&Gree n','Call',.,'Enable', 'off');,'&Blue' , 'Call',.,'Enable', 'off');'set(hlg,''E nab

8、le"," on'');''set(hlb,''E nable'',''o n'');');,'&Exit', 'Call','close(gcf)');uime nu(hplot,'Labe l'hc=uime nu(gcf,'Label','&Color');%定义Color菜单项hw=uime nu(hc,'Labe l','&am

9、p;Win dow Color');#实验6#实验62. hf=figure('menubar', 'none' , 'name','图形演示'numbertitle', 'off' );%定义图形窗口set(gcf,'un it','normalized','posi'axes( 'posi',0.05,0.15,0.55,0.7);uic on trol(gcf,'style', 'text',

10、9;unit''posi',0.63,0.85,0.1,0.1,'horizontal', 'center');uic on trol(gcf,'style', 'text','unit',0.2,0.3,0.55,0.36);%定义坐标轴,'normalized', .% 定义静态文本'string' ,'参数 a',.,'normalized',.ha=uic on trol(gcf,'style','

11、;edit','back' , 'w',.%定义编辑框'u nit','normalized','posi',0.80,0.85,0.15,0.1);hb=uic on trol(gcf,'style','edit','back' , 'w',.'u nit','normalized','posi',0.80,0.65,0.15,0.1);hn=uic on trol(gcf,'style

12、','edit','back' , 'w',.'u nit','normalized','posi',0.80,0.45,0.15,0.1);uic on trol(gcf,'style','push' , 'unit','normalized',. %定义按钮'posi',0.61,0.15,0.15,0.15,'string','绘图,'call',COMM);uic

13、on trol(gcf,'style','push' , 'unit','normalized'j 'posi',0.80,0.15,0.15,0.15,'string','关闭,'call' , 'close(gcf)');'posi' ,0.63,0.65,0.1,0.1,'horiz ontal',ce nter'uicontrol(gcf,'style' , 'text''

14、posi' ,0.63,0.45,0.1,0.1,'horizontal', 'center''string' ,'参 数 b');,'unit' , 'normalized',.'string' ,'参 数 n' );% 绘图COMM='a=str2 num(get(ha,''stri ng'');''b=str2 num(get(hb,''stri ng'');''n=str2 num(get(h n,"str in g'');''theta=0:0.01:2*pi;''rho=a*cos(b+n*theta);''polar(theta,rho);'改变参数a,如图所示4实验6#实验6#实验65实验6改变参数b,如图所示改变参数n,如图所示#实验66

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1