Lo1=Lo1; Lo2=Lo1; else
Lo1=0.5+Lo1; Lo2=Lo1; end
Ls1=(atan(1/(B*Zo)))/(2*pi); if Ls1>=0 Ls1=Ls1; Ls2=Ls1; else
Ls1=0.5+Ls1; Ls2=Ls1; end end else
m1=(X0+sqrt(R0*((Zo-R0)^2+X0^2)/Zo))/(R0-Zo); m2=(X0-sqrt(R0*((Zo-R0)^2+X0^2)/Zo))/(R0-Zo);
B1=(R0^2*m1-(Zo-X0*m1)*(X0+Zo*m1))/(Zo*(R0^2+(X0+Zo*m1)^2)); B2=(R0^2*m2-(Zo-X0*m2)*(X0+Zo*m2))/(Zo*(R0^2+(X0+Zo*m2)^2)); Lo1=(-atan(B1*Zo))/(2*pi); if Lo1>=0 Lo1=Lo1; else
Lo1=0.5+Lo1; end
Lo2=(-atan(B2*Zo))/(2*pi); if Lo2>=0 Lo2=Lo2; else
Lo2=0.5+Lo2; end
Ls1=(atan(1/(B1*Zo)))/(2*pi); if Ls1>=0 Ls1=Ls1; else
Ls1=0.5+Ls1; end
Ls2=(atan(1/(B2*Zo)))/(2*pi); if Ls2>=0 Ls2=Ls2; else
Ls2=0.5+Ls2; end
if m1>=0
d1=atan(m1)/(2*pi); if d1>=0.5
d1=d1-0.5; elseif d1<0 d1=d1+0.5; else
d1=d1; end
d2=(atan(m2)+pi)/(2*pi); if d2>=0.5
d2=d2-0.5; elseif d2<0 d2=d2+0.5; else
d2=d2; end else
d1=(atan(m1)+pi)/(2*pi); if d1>=0.5
d1=d1-0.5; elseif d1<0 d1=d1+0.5; else
d1=d1; end
d2=atan(m2)/(2*pi); if d2>=0.5
d2=d2-0.5; elseif d2<0 d2=d2+0.5; else
d2=d2; end end end
hold off;
%归一化阻抗和确定传播状态
R0= get(handles.R ,'string');%提取电阻电抗值 X0 = get(handles.X ,'string'); Zo= get(handles.Zo ,'string'); R0=str2double(R0);%格式转换 转换为数值 X0=str2double(X0); Zo=str2double(Zo);
r=R0/Zo; x=X0/Zo; z=r+i*x; y=1/z;
g=real(y); b=imag(y);
Gamma2=(z-1)/(z+1); Mod=abs(Gamma2); Phi=angle(Gamma2);
Lambda=(pi-Phi)/(4*pi); Alpha=(y-1)/(y+1);
plot(real(Alpha),imag(Alpha),'gp'); hold on;
plot(real(Gamma2),imag(Gamma2),'gp'); hold on;
aa=[real(Alpha),real(Gamma2)]; bb=[imag(Alpha),imag(Gamma2)]; polyfit(aa,bb,1); plot(aa,bb,'g'); hold on;
if X0<0
if(Phi>=0)
Lmin=Phi/(4*pi); Lmax=0.25+Lmin; else
Lmin=(pi+Phi)/(4*pi); Lmax=0.25+Lmin; end else
if(Phi>=0)
Lmax=Phi/(4*pi); Lmin=0.25+Lmax; else
Lmax=(pi+Phi)/(4*pi); Lmin=0.25+Lmax; end end
%画出单位圆和标出电刻度 t=0:0.0001:2*pi;
plot(cos(t),sin(t),'--g');
hold on;
plot([-1,1],[0,0],'g'); hold on;
plot([0,0],[-1,1],'g'); hold on;
axis('equal',[-1,1,-1,1]);
%画出等G圆 if g==inf
plot(1,0,'rp');
axis('equal',[-1,1,-1,1]); else
a=g/(1+g); g1=1/(1+g);
plot((g1*cos(t)+a),(g1*sin(t)),'r'); axis('equal',[-1,1,-1,1]); hold on; end;
%画出等B圆 if b==inf
plot(1,0,'rp');
axis('equal',[-1,1,-1,1]); elseif b==0
plot([-1,1],[0,0],'r'); axis('equal',[-1,1,-1,1]); else
b1=1/b; r2=1/b;
plot((r2*cos(t)+1),(r2*sin(t)+b1),'m'); axis('equal',[-1,1,-1,1]); hold on; end;
%画出等反射圆和匹配圆 y=g+j*b;
gamma=(y-1)/(y+1); Mod=abs(gamma); Phi=angle(gamma);
plot(Mod*cos(t),Mod*sin(t),'b'); hold on;
axis('equal',[-1,1,-1,1]);
plot(0.5*(cos(t)+1),(0.5*sin(t)),'c'); hold off; hold on;
%归一化及计参数
R0= get(handles.R ,'string');%提取电阻电抗值
X0 = get(handles.X ,'string'); Zo= get(handles.Zo ,'string');
R0=str2double(R0);%格式转换 转换为数值 X0=str2double(X0); Zo=str2double(Zo); r=R0/Zo; x=X0/Zo; z=r+i*x; y=1/z;
Alpha=atan2(imag(Gamma2),real(Gamma2)); alpha1=(y-1)/(y+1);
%计算匹配点位置 if R0==Zo
plot(real(Gamma2),imag(Gamma2),'rp'); plot(real(Gamma2),-imag(Gamma2),'rp'); m=[0,real(Gamma2)]; Re1=[0,cos(Alpha)]; Im1=[0,sin(Alpha)]; Im2=[0,-sin(Alpha)]; plot(Re1,Im1,'r'); plot(Re1,Im2,'r'); hold off; else
angle1=abs(atan2(imag(Gamma2),real(Gamma2))); angle2=2*pi*(d1/0.5)-angle1; if X0>=0
if angle2<0
angle2=2*pi+angle2;
plot(-abs(Gamma2)*cos(angle2),abs(Gamma2)*sin(angle2),'rp');
plot(-abs(Gamma2)*cos(angle2),-abs(Gamma2)*sin(angle2),'rp'); Re3=[0,cos(angle2)]; Re4=[0,cos(angle2)]; Im3=[0,sin(angle2)]; Im4=[0,-sin(angle2)]; plot(-Re3,Im3,'r'); plot(-Re4,Im4,'r'); hold off; else
angle2=angle2;
plot(-abs(Gamma2)*cos(angle2),abs(Gamma2)*sin(angle2),'rp');