?? shili53.m
字號:
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]);
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -