www.pudn.com > pol_cs.rar > pol_cs.m, change:2011-05-17,size:6402b


clc;clear; 
size1=450;size3=250;%数据大小 
 
fid0=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\程序\C3\C11.bin','rb');%滤波后数据 
c11=fread(fid0,'single');c11=reshape(c11,size1,size3);c11=c11'; 
fid1=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\程序\C3\C22.bin','rb'); 
c22=fread(fid1,'single');c22=reshape(c22,size1,size3);c22=c22'; 
fid2=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\程序\C3\C33.bin','rb'); 
c33=fread(fid2,'single');c33=reshape(c33,size1,size3);c33=c33'; 
fid3=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\程序\C3\C12_real.bin','rb'); 
c12_real=fread(fid3,'single');c12_real=reshape(c12_real,size1,size3);c12_real=c12_real'; 
fid4=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\程序\C3\C12_imag.bin','rb'); 
c12_imag=fread(fid4,'single');c12_imag=reshape(c12_imag,size1,size3); 
c12_imag=c12_imag';c12=c12_real+1i*c12_imag;c21=c12_real-1i*c12_imag; 
fid5=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\程序\C3\C13_real.bin','rb'); 
c13_real=fread(fid5,'single');c13_real=reshape(c13_real,size1,size3);c13_real=c13_real'; 
fid6=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\程序\C3\C13_imag.bin','rb'); 
c13_imag=fread(fid6,'single');c13_imag=reshape(c13_imag,size1,size3); 
c13_imag=c13_imag';c13=c13_real+1i*c13_imag;c31=c13_real-1i*c13_imag; 
fid7=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\程序\C3\C23_real.bin','rb'); 
c23_real=fread(fid7,'single');c23_real=reshape(c23_real,size1,size3);c23_real=c23_real'; 
fid8=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\程序\C3\C23_imag.bin','rb'); 
c23_imag=fread(fid8,'single');c23_imag=reshape(c23_imag,size1,size3); 
c23_imag=c23_imag';c23=c23_real+1i*c23_imag;c32=c23_real-1i*c23_imag; 
 
fid10=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\C3\C11.bin','rb');%原始数据 
C11=fread(fid10,'single');C11=reshape(C11,size1,size3);C11=C11'; 
fid11=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\C3\C22.bin','rb'); 
C22=fread(fid11,'single');C22=reshape(C22,size1,size3);C22=C22'; 
fid12=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\C3\C33.bin','rb'); 
C33=fread(fid12,'single');C33=reshape(C33,size1,size3);C33=C33'; 
fid13=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\C3\C12_real.bin','rb'); 
C12_real=fread(fid13,'single');C12_real=reshape(C12_real,size1,size3);C12_real=C12_real'; 
fid14=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\C3\C12_imag.bin','rb'); 
C12_imag=fread(fid14,'single');C12_imag=reshape(C12_imag,size1,size3); 
C12_imag=C12_imag';C12=C12_real+1i*C12_imag;C21=C12_real-1i*C12_imag; 
fid15=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\C3\C13_real.bin','rb'); 
C13_real=fread(fid15,'single');C13_real=reshape(C13_real,size1,size3);C13_real=C13_real'; 
fid16=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\C3\C13_imag.bin','rb'); 
C13_imag=fread(fid16,'single');C13_imag=reshape(C13_imag,size1,size3); 
C13_imag=C13_imag';C13=C13_real+1i*C13_imag;C31=C13_real-1i*C13_imag; 
fid17=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\C3\C23_real.bin','rb'); 
C23_real=fread(fid17,'single');C23_real=reshape(C23_real,size1,size3);C23_real=C23_real'; 
fid18=fopen('C:\Documents and Settings\Administrator\桌面\halfmoon\C3\C23_imag.bin','rb'); 
C23_imag=fread(fid18,'single');C23_imag=reshape(C23_imag,size1,size3); 
C23_imag=C23_imag';C23=C23_real+1i*C23_imag;C32=C23_real-1i*C23_imag; 
 
R=[1 1 0 0; 1 -1 0 0; 0 0 1 1 ;0 0 -1i 1i];%R矩阵 
R1=[1 1 0 0; 1 -1 0 0; 0 0 1 1i; 0 0 1 -1i];%R的逆矩阵 
theta1=0;%共极化 
theta2=180;%交叉极化 
a=-45:5/18:45;%椭圆率角取样点数 
b=90:-5/9:-90;%方位极化角取样点数 
m_gong_sum=0;m_jc_sum=0;%参数初始值设置 
std_gong_sum=0;std_jc_sum=0;%参数初始值设置 
%c=191;d=121;%计算参数所用像素的起始位置(c为行,d为列。) 
%c=45;d=233; 
%c=204;d=258; 
 
%c=41;d=253; 
%c=62;d=241; 
c=59;d=256; 
for m=c:c+2  %%%%%%%%%%%%%%%%%%%%%(m,n分别为行列所取值,后面的数字为自己设置值。如选择10乘10的窗口,两个数字均为9) 
    for n=d:d+6 %%%%%%%%%%%%%%%%%%%%% 
        W=[c33(m,n) c22(m,n)./2 c32(m,n) c23(m,n);c22(m,n)./2 c11(m,n) c21(m,n) c12(m,n);c32(m,n) c21(m,n) c31(m,n) c22(m,n)./2;c23(m,n) c12(m,n) c22(m,n)./2 c13(m,n)];%滤波后数据的W矩阵 
        W0=[C33(m,n) C22(m,n)./2 C32(m,n) C23(m,n);C22(m,n)./2 C11(m,n) C21(m,n) C12(m,n);C32(m,n) C21(m,n) C31(m,n) C22(m,n)./2;C23(m,n) C12(m,n) C22(m,n)./2 C13(m,n)];%原始数据的W矩阵 
        k0=R*W0*R1;k=R*W*R1;%滤波前后的K矩阵 
        k0=k0./norm(k0);k=k./norm(k);%滤波前后的K矩阵归一化 
        P_gong=zeros(325,325);P_jc=zeros(325,325);%数据预留空间,根据取样点数决定.P_gong为滤波后共极化的接收功率,P_jc为滤波后交叉极化的接收功率。 
        P_gong_0=zeros(325,325);P_jc_0=zeros(325,325);%数据预留空间,根据取样点数决定.P_gong_0为原始数据共极化的接收功率,P_jc_0为原始数据交叉极化的接收功率。 
        zb1=1;%需要将P_gong等放在相应的矩阵中,设置其在矩阵中的位置 
        for x=-45:5/18:45; 
            zb2=1; 
            for y=90:-5/9:-90; 
                xt=[1 cos(2*x*pi/180)*cos(2*y*pi/180) cos(2*x*pi/180)*sin(2*y*pi/180) sin(2*x*pi/180)]';%发射波的J矢量 
                xr1=[1 cos((theta1-2*x)*pi/180)*cos(2*y*pi/180) cos((theta1-2*x)*pi/180)*sin(2*y*pi/180) sin((theta1-2*x)*pi/180)];%共极化接收波的J矢量 
                xr2=[1 cos((theta2-2*x)*pi/180)*cos(2*y*pi/180) cos((theta2-2*x)*pi/180)*sin(2*y*pi/180) sin((theta2-2*x)*pi/180)];%交叉极化接收波的J矢量 
                P_gong(zb1,zb2)=xr1*k*xt;P_jc(zb1,zb2)=xr2*k*xt;P_gong_0(zb1,zb2)=xr1*k0*xt;P_jc_0(zb1,zb2)=xr2*k0*xt;%求功率 
                zb2=zb2+1; 
            end 
            zb1=zb1+1; 
        end 
        m_gong=sum(sum(abs(P_gong-P_gong_0)))/(length(a)*length(b)); 
        m_jc=sum(sum(abs(P_jc-P_jc_0)))/(length(a)*length(b)); 
        std_gong=sqrt(sum(sum(abs(abs(P_gong-P_gong_0)-m_gong).^2))/(length(a)*length(b)-1)); 
        std_jc=sqrt(sum(sum(abs(abs(P_jc-P_jc_0)-m_jc).^2))/(length(a)*length(b)-1)); 
        m_gong_sum=m_gong+m_gong_sum; 
        m_jc_sum=m_jc+m_jc_sum; 
        std_gong_sum=std_gong+std_gong_sum; 
        std_jc_sum=std_jc+std_jc_sum; 
    end 
end 
m_gong_mean=m_gong_sum/21%%%%%%%%%%%%%%%%%%%%%%%%%%%计算均值,若用10X10的数据做,分母应该为100 
m_jc_mean=m_jc_sum/21%%%%%%%%%%%%%%%%%%%%%%%% 
std_gong_mean=std_gong_sum/21%%%%%%%%%%%%%%% 
std_jc_mean=std_jc_sum/21%%%%%%%%%%%%%%