【奠基经典】MATLAB实用程序案例之可设置函数曲线光源的用户界面
可设置函数曲线光源的用户界面
实例:
h0=figure('toolbar','none',...
'position',,...
'name','实例53');
h1=axes('parent',h0,...
'position',,...
'visible','off');
=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',);
button1=uicontrol('parent',h0,...
'style','pushbutton',...
'string','设置光线',...
'position',,...
'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'',);,',...
'set(edit1,''string'',[''['',num2str(k1),''
'',num2str(k2),'' '',num2str(k3),'']'']);']);
button2=uicontrol('parent',h0,...
'style','pushbutton',...
'string','关闭',...
'position',,...
'callback','close');
edit1=uicontrol('parent',h0,...
'style','edit',...
'max',2,...
'min',0,...
'fontsize',15,...
'backgroundcolor',,...
'string','',...
'position',);
text1=uicontrol('parent',h0,...
'style','text',...
'backgroundcolor',,...
'fontsize',15,...
'string','光线来源坐标',...
'position',);
关于本帖内容欢迎大家踊跃讨论,与在下交流!
页:
[1]