clear all;
num=1024;
x=[1:num];
y=[1:num];
[X1,Y1]=meshgrid(x,y);
%%%%s=0.2%%%%%%%
Radius=300;
CenterX=400;
CenterY=500;
shear_value=120;
lamda=532;
rad=2*pi/lamda;
X2=(X1-CenterX)/Radius;
Y2=(Y1-CenterY)/Radius;
s=shear_value/Radius;
r=X2.^2+Y2.^2;
flag1=(r<=1);
flag11=(r>1);
r1=X2.^2/(1-s)+Y2.^2/(1-s)^2;
flag1_elliptical=(r1<=1);
flag11_elliptical=(r1>1);
r2=Y2.^2/(1-s)+X2.^2/(1-s)^2;
flag2_elliptical=(r2<=1);
flag22_elliptical=(r2>1);
X=zeros(num,num);
Y=zeros(num,num);
X(flag1)=X2(flag1);
Y(flag1)=Y2(flag1);
XX=zeros(num,num);
YY=zeros(num,num);
XX(flag1_elliptical)=X2(flag1_elliptical);
YY(flag1_elliptical)=Y2(flag1_elliptical);
a0=rad*3;
a1=rad*8;
a2=rad*10;
a3=rad*15;
a4=rad*0.7;
a5=rad*0.5;
a6=rad*0.2;
a7=rad*0.15;
a8=rad*0.1;
a9=rad*0.01;
Z0=1;
Z1=Y;
Z2=X;
Z3=2.*X.*Y;
Z4=2.*(X.^2+Y.^2)-1;
Z5=X.^2-Y.^2;
Z6=3.*X.^2.*Y-Y.^3;
Z7=3.*X.^2.*Y+3.*Y.^3-2.*Y;
Z8=3.*X.^3-3.*X.*Y.^2-2.*X;
Z9=X.^3-3.*X.*Y.^2;
phi=a0.*Z0+a1.*Z1+a2.*Z2+a3.*Z3+a4.*Z4+a5.*Z5+a6.*Z6+a7.*Z7+a8.*Z8+a9.*Z9;
phi(flag11)=0;
Vx=phi;
Vx_s=zeros(size(Vx));
Vx_s(shear_value+1:num,:)=Vx(1:num-shear_value,:);
V_x=Vx-Vx_s;
V_x(flag11_elliptical)=0;
% figure,imagesc(V_x);axis square
[M,N]=size(Vx);
Z11=reshape(Z1',1,M*N);
Z22=reshape(Z2',1,M*N);
Z33=reshape(Z3',1,M*N);
Z44=re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10)=Z99*Z99';
B=zeros(10,1);
B(1,1)=sum(VV);
B(2,1)=Z11*VV';
B(3,1)=Z22*VV';
B(4,1)=Z33*VV';
B(5,1)=Z44*VV';
B(6,1)=Z55*VV';
B(7,1)=Z66*VV';
B(8,1)=Z77*VV';
B(9,1)=Z88*VV';
B(10,1)=Z99*VV';
b=ones(10,1);
b=A\B;
a=[a0,a1,a2,a3,a4,a5,a6,a7,a8,a9]';
c=b-a;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%以上为测试%%%%%%%%%%%%%%%%%%%%%%%%%%
Vy_s=zeros(size(Vx));
Vy_s(:,shear_value+1:num)=Vx(:,1:num-shear_value);
V_y=Vx-Vy_s;
V_y(flag22_elliptical)=0;
[M,N]=size(Vx);
Z11=reshape(Z1',1,M*N);
Z22=reshape(Z2',1,M*N);
Z33=reshape(Z3',1,M*N);
Z44=reshape(Z4',1,M*N);
Z55=reshape(Z5',1,M*N);
Z66=reshape(Z6',1,M*N);
Z77=reshape(Z7',1,M*N);
Z88=reshape(Z8',1,M*N);
Z99=reshape(Z9',1,M*N);
VVy=reshape(V_y',1,M*N);
By=zeros(10,1);
By(1,1)=sum(VVy);
By(2,1)=Z11*VVy';
By(3,1)=Z22*VVy';
By(4,1)=Z33*VVy';
By(5,1)=Z44*VVy';
By(6,1)=Z55*VVy';
By(7,1)=Z66*VVy';
By(8,1)=Z77*VVy';
By(9,1)=Z88*VVy';
By(10,1)=Z99*VVy';
by=ones(10,1);
by=A\By;
Mx=zeros(10,6);
Mx(:,1)=[s,0,0,0,0,0,0,0,0,0]';
Mx(:,2)=[0,2*s,0,0,0,0,0,0,0,0]';
Mx(:,3)=[s^2,0,2*s,0,0,0,0,0,0,0]';
Mx(:,4)=[0,3,s^2,0,3*s,0,0,0,0,0]';
Mx(:,5)=[3,s^3+s,0,9,s^2,0,3*s,3*s,0,0]';
Mx(:,6)=[s^3,0,3*s^2,0,0,3*s,0,0,0,0]';
My=zeros(10,6);
My(:,1)=[s,0,0,0,0,0,0,0,0,0]';
My(:,2)=[-s^2,-2*s,0,0,0,0,0,0,0,0]';
Mx(:,3)=[0,0,2*s,0,0,0,0,0,0,0]';
Mx(:,4)=[0,0,3*s^2,3*s,0,0,0,0,0,0]';
My(:,5)=[-s^3,-3*s^2,0,0,0,3*s,0,0,0,0]';
My(:,6)=[s+3*s^3,9*s^2,0,0,3*s,-3*s,0,0,0,0]';
kx=Mx\b;
ky=My\by;
评论7