实例52:可设置函数曲线图视角的用户界面
h0=figure('toolbar','none',...
'position',[198 56 408 468],...
'name','实例52');
h1=axes('parent',h0,...
'position',[0.15 0.5 0.7 0.5],...
'visible','off');
[x,y]=meshgrid(-8:0.5:8);
r=sqrt(x.^2+y.^2)+eps;
z=sin(r)./r;
fh=surf(x,y,z);
shading interp
view([-60 30])
fv=get(h1,'view');
fv2=fv;
camlight left
sh1=uicontrol('parent',h0,...
'style','slider',...
'max',1,...
'min',-1,...
'value',fv(1)/180,...
'position',[20 150 200 20],...
'callback',[...
'fv(1)=90*get(sh1,''value'');,',...
'set(h1,''view'',[fv(1) fv(2)]),',...
'set(ed1,''string'',fv(1))']);
text1=uicontrol('parent',h0,...
'style','text',...
'string','方位角的变化滑标',...
'position',[20 170 200 20]);
sh2=uicontrol('parent',h0,...
'style','slider',...
'max',1,...
'min',-1,...
'value',fv(2)/180,...
'position',[20 90 200 20],...
'callback',[...
'fv(2)=90*get(sh2,''value'');,',...
'set(h1,''view'',[fv(1) fv(2)]),',...
'set(ed2,''string'',fv(2))']);
text2=uicontrol('parent',h0,...
'style','text',...
'string','仰角的变化滑标',...
'position',[20 110 200 20]);
ed1=uicontrol('parent',h0,...
'style','edit',...
'string',fv(1),...
'position',[30 30 50 20]);
text3=uicontrol('parent',h0,...
'style','text',...
'string','方位角的数值',...
'position',[20 50 80 20]);
ed2=uicontrol('parent',h0,...
'style','edit',...
'string',fv(2),...
'position',[150 30 50 20]);
text4=uicontrol('parent',h0,...
'style','text',...
'string','仰角的数值',...
'position',[135 50 80 20]);
pf1=uicontrol('parent',h0,...
'style','pushbutton',...
'string','重置',...
'position',[280 120 50 30],...
'callback',[...
'set(h1,''view'',fv2),',...
'set(sh1,''value'',fv2(1)/180),',...
'set(sh2,''value'',fv2(2)/180),',...
'set(ed1,''string'',fv2(1)),',...
'set(ed2,''string'',fv2(2))']);
pf2=uicontrol('parent',h0,...
'style','pushbutton',...
'string','关闭',...
'position',[280 60 50 30],...
'callback','close');
实例53:可设置函数曲线光源的用户界面
h0=figure('toolbar','none',...
'position',[198 56 408 468],...
'name','实例53');
h1=axes('parent',h0,...
'position',[0.15 0.5 0.7 0.5],...
'visible','off');
[x,y]=meshgrid(-8:0.5:8);
r=sqrt(x.^2+y.^2)+eps;
z=sin(r)./r;
fh=surf(x,y,z);
shading interp
view([-60 30])
camlight left
lightk=light('position',[0 -2 1]);
button1=uicontrol('parent',h0,...
'style','pushbutton',...
'string','设置光线',...
'position',[80 60 70 30],...
'callback',[...
'an1=inputdlg(''光线来源的X轴坐标'');,',...
'k1=str2num(an1{1});,',...
'an2=inputdlg(''光线来源的Y轴坐标'');,',...
'k2=str2num(an2{1});,',...
'an3=inputdlg(''光线来源的Z轴坐标'');,',...
'k3=str2num(an3{1});,',...
'set(lightk,''position'',[k1 k2 k3]);,',...
'set(edit1,''string'',[''['',num2str(k1),'' '',num2str(k2),'' '',num2str(k3),'']'']);']);
button2=uicontrol('parent',h0,...
'style','pushbutton',...
'string','关闭',...
'position',[250 60 70 30],...
'callback','close');
edit1=uicontrol('parent',h0,...
'style','edit',...
'max',2,...
'min',0,...
'fontsize',15,...
'backgroundcolor',[1 1 1],...
'string','[0 -2 1]',...
'position',[80 110 220 30]);
text1=uicontrol('parent',h0,...
'style','text',...
'backgroundcolor',[0.75 0.75 0.75],...
'fontsize',15,...
'string','光线来源坐标',...
'position',[80 140 220 30]);
实例54:添加效果
h0=figure('toolbar','none',...
'position',[200 50 300 350],...
'name','实例54');
h1=axes('parent',h0,...
'position',[0.2 0.4 0.6 0.6],...
'visible','off');
ezsurf('sin(sqrt(x.^2+y.^2))/sqrt(x.^2+y.^2)',[-6*pi,6*pi])
b1=uicontrol('parent',h0,...
'units','points',...
'tag','b1',...
'style','pushbutton',...
'string','设置',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[40 50 50 20],...
'callback',[...
'view(0,75);,',...
'shading interp;,',...
'lightangle(-45,30);,',...
'k=findobj(gca,''type'',''surface'');,'...
'set(k,''facelighting'',''phong'');,',...
'set(k,''ambientstrength'',0.3);,',...
'set(k,''diffusestrength'',0.8);,',...
'set(k,''specularstrength'',0.9);,',...
'set(k,''specularexponent'',25);,',...
'set(k,''backfacelighting'',''unlit'')']);
b2=uicontrol('parent',h0,...
'units','points',...
'tag','b2',...
'style','pushbutton',...
'string','关闭',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[120 50 50 20],...
'callback','close');
实例55:查询日期
h0=figure('toolbar','none',...
'position',[198 56 408 468],...
'name','实例55');
h1=axes('parent',h0,...
'position',[0.15 0.5 0.7 0.5],...
'visible','off');
huidiao=[...
'yearnum=str2num(get(edit1,''string''));,',...
'monthnum=str2num(get(edit2,''string''));,',...
'daynum=str2num(get(edit3,''string''));,',...
'monthday=[0 31 28 31 30 31 30 31 31 30 31 30 31];,',...
'dyear=yearnum-2000;,',...
'beishu=fix(dyear/4);,',...
'yushu=rem(yearnum,4);,',...
'if yushu==0,',...
'monthday(3)=29;,',...
'end,',...
'mday=0;,',...
'for i=1:monthnum,',...
'mday=monthday(i)+mday;,',...
'end,',...
'yearday=mday+daynum-1;,',...
'noweek=fix(yearday/7);,',...
'set(edit5,''string'',[''第'',num2str(noweek),''周'']);,',...
'if dyear>0,',...
'if yushu==0,',...
'beishu=beishu-1;,',...
'end,',...
'dday=yearday+365*dyear+beishu+1;,',...
'end,',...
'if dyear<=0,',...
'dday=365*dyear+yearday+beishu;,',...
'end,',...
'mweek=rem(dday,7)+7;,',...
'if mweek==8,',...
'set(edit4,''string'',''Sunday'');,',...
'end,',...
'if mweek==9,',...
'set(edit4,''string'',''Monday'');,',...
'end,',...
'if mweek==10,',...
'set(edit4,''string'',''Tuesday'');,',...
'end,',...
'if mweek==11,',...
'set(edit4,''string'',''Wednesday'');,',...
'end,',...
'if mweek==12,',...
'set(edit4,''string'',''Thursday'');,',...
'end,',...
'if mweek==13,',...
'set(edit4,''string'',''Friday'');,',...
'end,',...
'if mweek==7,',...
'set(edit4,''string'',''Saturday'');,',...
'end,',...
'if mweek==6,',...
'set(edit4,''string'',''Friday'');,',...
'end,',...
'if mweek==5,',...
'set(edit4,''string'',''Thursday'');,',...
'end,',...
'if mweek==4,',...
'set(edit4,''string'',''Wednesday'');,',...
'end,',...
'if mweek==3,',...
'set(edit4,''string'',''Tuesday'');,',...
'end,',...
'if mweek==2,',...
'set(edit4,''string'',''Monday'');,',...
'end,',...
'if mweek==1,',...
'set(edit4,''string'',''Sunday'');,',...
'end'];
edit1=uicontrol('parent',h0,...
'style','edit',...
'horizontalalignment','right',...
'position',[40 300 50 20]);
text1=uicontrol('parent',h0,...
'style','text',...
'string','年',...
'horizontalalignment','left',...
'position',[90 300 50 20]);
edit2=uicontrol('parent',h0,...
'style','edit',...
'horizontalalignment','right',...
'position',[160 300 50 20]);
text2=uicontrol('parent',h0,...
'style','text',...
'string','月',...
'horizontalalignment','left',...
'position',[210 300 50 20]);
edit3=uicontrol('parent',h0,...
'styl
matlab3.rar_函数曲线图
版权申诉
182 浏览量
2022-09-23
07:30:57
上传
评论
收藏 2KB RAR 举报
我虽横行却不霸道
- 粉丝: 75
- 资源: 1万+
最新资源
- 基于python实现的高考志愿填报参考系统源码+sql数据库(高分毕业设计).zip
- 基于python实现的高考志愿填报参考系统源码+数据库(毕业设计).zip
- 人工智能大赛无人车挑战杯车道线检测python源码.zip
- 基于风控模型的银行客户信用风险评估系统源码+项目说明+数据集(使用jupter notebook).zip
- python基于可变卷积改进的U-Net网络实现对胰腺细胞的精准切割源码(高分项目).zip
- python基于可变卷积改进的U-Net网络实现对胰腺细胞的精准切割源码(高分项目).zip
- 基于javascript实现的蚁群算法(JS代码)
- 基于python实现的随机森林(python代码)
- python读取excel到数据库中,简单的数据库管理脚本
- 7777端口抓包数据集
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈