beta=2*pi;
pz=0.05; z=0:pz:1.6;
omega=2*pi;
pt=0.05; t=0:pt:1;
%t=0.0;

ex=1;
ey=0.5;
dephase=-135;
mm=max(ex,ey);

cas=1;

if (cas==1)
[Z,T]=meshgrid(z,t);
x=zeros(1,length(z));
[Exzt,Eyzt]=polaris(ex,ey,dephase,omega,T,beta,Z);
M=moviein(length(t));
for i=1:length(t);
	plot3(z,Exzt(i,:),Eyzt(i,:),'g');
	axis([0,max(z),-mm,mm,-mm,mm]);
    daspect([0.5 1 1]);
    xlabel('z');ylabel('x');zlabel('y');
	hold on;
	plot3(z,x,x,'k');
	quiver3(z,x,x,x,Exzt(i,:),Eyzt(i,:),0,'r');
	hold off;
	M(:,i)=getframe;
end
movie(M,1)
end
    
if (cas==2)
[Exz,Eyz,psie,AR] = polaris(ex,ey,dephase,omega,0,beta,z);
[Ext,Eyt] = polaris(ex,ey,dephase,omega,t,beta,0);
fprintf('inclinaison=%6.1f\n',psie);
fprintf('rapport=%6.2f\n',AR);

x=zeros(1,length(z));
subplot(1,2,1);
plot3(z,Exz,Eyz,'g');
xlabel('z');ylabel('x');zlabel('y');
axis([0,max(z),-mm,mm,-mm,mm]); axis equal;
hold on;
plot3(z,x,x,'k');
quiver3(z,x,x,x,Exz,Eyz,0,'r');
hold off;
subplot(1,2,2);
h=gca;
plot(Ext,Eyt,'g');
xlabel('x');ylabel('y');
mm=1.1*mm;
axis([-mm,mm,-mm,mm]);
grid on;
set(h,'XDir','reverse');
hold on;
dEx=gradient(Ext);
dEy=gradient(Eyt);
quiver(Ext(2:end-1),Eyt(2:end-1),dEx(2:end-1),dEy(2:end-1),'g');
hold off;
end
