cooldog123pp 发表于 2024-7-26 23:48

实例:可设置函数曲线光源的用户界面

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',);

VelvetStars 发表于 2025-6-15 19:12

感谢楼主分享,这个是用于什么场景

cooldog123pp 发表于 2025-6-25 13:17

VelvetStars 发表于 2025-6-15 19:12
感谢楼主分享,这个是用于什么场景

回复帖子就能下载学习了,收到老铁的感谢,还会努力。
页: [1]
查看完整版本: 实例:可设置函数曲线光源的用户界面