士心之约 发表于 2015-9-23 09:40

【MATLAB动画教程十二】

%Fraunhofer Diffraction of a Round Hole
%弗朗和费衍射模拟Matlab源代码
%rewrite by dynamic
%all rights reserved by www.matlabsky.cn
%2008.12.3
close all
figure('numbertitle','off','name','弗朗和费衍射模拟--by Matlabsky',...
'toolbar','none','position',);
axes('position',);hold on;
title('Fraunhofer Diffraction of a Round Hole',...
'fontsize',14)
set(gcf,'doublebuffer','on');
axis([-4,12,-5,5]);
rectangle('position',,'FaceColor',);
rectangle('position',,'FaceColor',);
rectangle('position',,'FaceColor',...
,'Curvature',);
rectangle('position',,'FaceColor',);
h1=plot([-4,-4],[-0.7,-0.7]);
h2=plot([-4,-4],);
h3=plot([-4,-4],);
for k=-4:.1:0;
pause(0.05);
try
set(,'xdata',[-4,k]);
catch
return
end
end
y=-4:.1:4;
a=linspace(-atan(4/11),atan(4/11),length(y));
a=10*sin(a);
II=abs(sinc(a)).^2*6;
x=11-II;
plot(x,y,'r')
K=find(diff(sign(diff(II)))==-2)+1;
yyN=y(K);
P=zeros(3,5); yN=[-0.7,0,0.7];H=P;
for m=1:3;
for n=1:5;
P(m,n)=complex(p(1),p(2));
H(m,n)=plot(0,yN(m));
end
end
for Q=0:.1:11;
pause(0.05)
for w=1:15;
=ind2sub(,w);
Y=polyval(,Q);
try
set(H(w),'xdata',,'ydata',);
catch
return
end
end
end
axes('position',)
a=linspace(-atan(4/11),atan(4/11),300);
=meshgrid(a);
r=sqrt(X.^2+Y.^2);
R=10*sin(r);
II=abs(sinc(R)).^2*6;
imshow(II);

森之张卫东 发表于 2015-9-23 22:49

运行不了!!!!

士心之约 发表于 2015-9-24 08:39

森之张卫东 发表于 2015-9-23 22:49 static/image/common/back.gif
运行不了!!!!

%Fraunhofer Diffraction of a Round Hole
%弗朗和费衍射模拟Matlab源代码
%rewrite by dynamic
%all rights reserved by www.matlabsky.cn
%2008.12.3

close all
figure('numbertitle','off','name','弗朗和费衍射模拟--by Matlabsky','toolbar','none','position',);
axes('position',);hold on;
title('Fraunhofer Diffraction of a Round Hole',...
   'fontsize',14)
set(gcf,'doublebuffer','on');
axis([-4,12,-5,5]);
rectangle('position',,'FaceColor',);
rectangle('position',,'FaceColor',);
rectangle('position',,'FaceColor',...
   ,'Curvature',);
rectangle('position',,'FaceColor',);
h1=plot([-4,-4],[-0.7,-0.7]);
h2=plot([-4,-4],);
h3=plot([-4,-4],);
for k=-4:.1:0;
   pause(0.05);
   try
       set(,'xdata',[-4,k]);
   catch
       return
   end
end
y=-4:.1:4;
a=linspace(-atan(4/11),atan(4/11),length(y));
a=10*sin(a);
II=abs(sinc(a)).^2*6;
x=11-II;
plot(x,y,'r')
K=find(diff(sign(diff(II)))==-2)+1;
yyN=y(K);
P=zeros(3,5); yN=[-0.7,0,0.7];H=P;
for m=1:3;
   for n=1:5;
       p=polyfit(,,1);
       P(m,n)=complex(p(1),p(2));
       H(m,n)=plot(0,yN(m));
   end
end
for Q=0:.1:11;
   pause(0.05)
   for w=1:15;
       =ind2sub(,w);
       Y=polyval(,Q);
       try
           set(H(w),'xdata',,'ydata',);
       catch
           return
       end
   end
end
axes('position',)
a=linspace(-atan(4/11),atan(4/11),300);
=meshgrid(a);
r=sqrt(X.^2+Y.^2);
R=10*sin(r);
II=abs(sinc(R)).^2*6;
imshow(II);
页: [1]
查看完整版本: 【MATLAB动画教程十二】