上传者: 27595745
|
上传时间: 2022-01-02 09:03:32
|
文件大小: 1KB
|
文件类型: RAR
function optics_prism
close all
figure('position',[78 276 792 402]);
xp=[-0.2,0.2,0];yp=[0.2,0.2,0.5];B=pi/14;
ZZ=[xp;yp]'*[cos(B),sin(B);-sin(B),cos(B)];
fill(ZZ(:,1),ZZ(:,2),[0.2,0.4,0.6]);
axis([-1,1,0,1]);hold on;set(gca,'color','k');
t=0;A=pi/8;set(gcf,'doublebuffer','on');
x=[-1,-1];y=[0,0];
H=plot(x,y,'w','linewidth',6);
while t<0.8;
pause(0.1);
t=t+0.1;
x(2)=-1+t*cos(A);
y(2)=t*sin(A);
set(H,'xdata',x,'ydata',y);
end
x1=[x(2),x(2)];y1=[y(2),y(2)];H1=plot(x1,y1,'r');
H2=plot(x1,y1,'color',[1,1,0]);x2=x1;y2=y1;
H3=plot(x1,y1,'y');x3=x1;y3=y1;
H4=plot(x1,y1,'g');x4=x1;y4=y1;
H5=plot(x1,y1,'color',[0,1,1]);x5=x1;y5=y1;
H6=plot(x1,y1,'b');x6=x1;y6=y1;
H7=plot(x1,y1,'color',[1,0,1]);x7=x1;y7=y1;
t=0;
C=linspace(pi/16,0,7);
s=linspace(1,1.2,7);
while t<0.165;
pause(0.1);