[Fortran] 纯文本查看 复制代码
program main
implicit none
real*8 A,B,C,D,ref,Z0,Zi
real*8 E,H
real*8 f,s
real*8 A2,A3,A4,As,Al,A1
real,parameter::pi=3.14159
integer,parameter::Zrs=5
integer k
real*8::Zr(Zrs)=(/2.0,4.0,6.0,8.0,10.0/)
common /group1/Zi
common /group2/Z0
real::daltf=0.0
integer i
!!!!!!!!!
Z0=50.0
Zi=-3.0
!!!!!!!!
do i=1,int(0.35/0.001)
do k=1,Zrs
daltf=daltf+0.001
call Get_ref(Zr(k),E(k),H(k),ref(k))
write(*,*) k,ref(k)
write(*,*) daltf
end do
end do
stop
end
!!!!!!!As,A2,A3,A4,Al*************************
subroutine daltf_to_As(daltf,As)
implicit none
real*8 daltf,As
As=0.015*(1+daltf/35.0)
return
end
subroutine daltf_to_A2(daltf,A2)
implicit none
real*8 daltf,A2
A2=0.25*(1+daltf/35.0)
return
end
subroutine daltf_to_A3(daltf,A3)
implicit none
real*8 daltf,A3
A3=0.0689*(1+daltf/35.0)
return
end
subroutine daltf_to_A4(daltf,A4)
implicit none
real*8 daltf,A4
A4=0.419*(1+daltf/35.0)
return
end
subroutine daltf_to_Al(daltf,Al)
implicit none
real*8 daltf,Al
Al=0.4808*(1+daltf/35.0)
return
end
!!!!!!!!****************************************
!!A1,A,B,C,D************************************
subroutine Get_A1(daltf,As,Al,A1)
implicit none
real*8 As,Al,A1,daltf
real,parameter::pi=3.14159
call daltf_to_As(daltf,As)
call daltf_to_A1(daltf,Al)
A1=(1.0/2.0*pi)*atan(1.0/(1.0/tan(2.0*pi*As)+1.0/tan(2.0*pi*Al)))
return
end
subroutine Get_AB(daltf,A2,A3,A4,A,B)
implicit none
real*8 A2,A3,A4,A,B,Z0,daltf
real,parameter::pi=3.14259
common /group2/Z0
call daltf_to_A2(daltf,A2)
call daltf_to_A3(daltf,A3)
call daltf_to_A4(daltf,A4)
A=(cos(2.0*pi*A2)+sin(2.0*pi*A2)/tan(2.0*pi*A3))*cos(2.0*pi*A4)-sin(2.0*pi*A2)*sin(2.0*pi*A4)
B=((cos(2.0*pi*A2)+sin(2.0*pi*A2)/tan(2.0*pi*A3))*sin(2.0*pi*A4)+sin(2.0*pi*A2)*cos(2.0*pi*A4))*Z0
return
end
subroutine Get_CD(daltf,A1,A2,A3,A4,C,D)
implicit none
real*8 A1,A2,A3,A4,Z0,C,D,daltf,Al,As
real,parameter::pi=3.14259
common /group2/Z0
call Get_A1(daltf,As,Al,A1)
call daltf_to_A2(daltf,A2)
call daltf_to_A3(daltf,A3)
call daltf_to_A4(daltf,A4)
C=((-1.0/tan(2.0*pi*A1)*cos(2.0*pi*A2)+sin(2.0*pi*A2)-(1.0/tan(2.0*pi*A1)*sin(2.0*pi*A2)+cos(2.0*pi*A2))/tan(2.0*pi*A3))*cos(2.0*pi*A4)+(1.0/tan(2.0*pi*A1)*sin(2.0*pi*A2)+cos(2.0*pi*A2))*sin(2.0*pi*A4))/Z0
D=(1.0/tan(2.0*pi*A1)*cos(2.0*pi*A2)-sin(2.0*pi*A2)+(1.0/tan(2.0*pi*A1)*sin(2.0*pi*A2)+cos(2.0*pi*A2))/tan(2.0*pi*A3))*sin(2.0*pi*A4)+(1.0/tan(2.0*pi*A1)*sin(2.0*pi*A2)+cos(2.0*pi*A2))*cos(2.0*pi*A4)
return
end
!!!*********************************************
!!!E的表达式
subroutine Get_E(Zr,A1,A2,A3,A4,E)
implicit none
real*8 A,B,C,D,E,A1,A2,A3,A4,daltf
real*8 Zr,Z0,Zi
common /group1/Zi
common /group2/Z0
call Get_AB(daltf,A2,A3,A4,A,B)
call Get_CD(daltf,A1,A2,A3,A4,C,D)
E=(A*Zr*(D-C*Zi)+C*Zr*(B+A*Zi))/(((D-C*Zi)**2+Zr**2*C**2)*Z0)
return
end
!!!H的表达式
subroutine Get_H(Zr,A1,A2,A3,A4,H)
implicit none
real*8 A,B,C,D,Zr,Zi,Z0,H,A1,A2,A3,A4,daltf
common /group1/Zi
common /group2/Z0
call Get_AB(daltf,A2,A3,A4,A,B)
call Get_CD(daltf,A1,A2,A3,A4,C,D)
H=((B+A*Zi)*(D-C*Zi)-A*C*Zr**2)/(((D-C*Zi)**2+Zr**2*C**2)*Z0)
return
end
!!!ref反射系数
subroutine Get_ref(Zr,E,H,ref)
implicit none
real*8 E,H,Zr,ref,A1,A2,A3,A4
call Get_E(Zr,A1,A2,A3,A4,E)
call Get_H(Zr,A1,A2,A3,A4,H)
ref=((E**2-1+H**2)**2+4*H**2)/(((E+1)**2+H**2)**2)
return
end