|
9#
楼主 |
发表于 2014-4-26 22:34:43
|
只看该作者
那个啥,我改完后有几个错误还是解决不了,麻烦你给指导指导,谢谢
[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
!!!!!!!!!
Z0=50.0
Zi=-3.0
!!!!!!!!
real::daltf=0.0
integer i
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(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
real*8 Zr,Z0,Zi
common /group1/Zi
common /group2/Z0
call Get_AB(A2,A3,A4,A,B)
call Get_CD(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
common /group1/Zi
common /group2/Z0
call Get_AB(A2,A3,A4,A,B)
call Get_CD(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
以下是错误提示
-------------------Configuration: tu11 - Win32 Debug--------------------
Compiling Fortran...
C:\Program Files\Microsoft Visual Studio\MyProjects\tu11\tu11.f90
C:\Program Files\Microsoft Visual Studio\MyProjects\tu11\tu11.f90(17) : Error: A specification statement cannot appear in the executable section.
real::daltf=0.0
^
C:\Program Files\Microsoft Visual Studio\MyProjects\tu11\tu11.f90(19) : Error: A specification statement cannot appear in the executable section.
integer i
^
C:\Program Files\Microsoft Visual Studio\MyProjects\tu11\tu11.f90(20) : Error: This name does not have a type, and must have an explicit type. [I]
do i=1,int(0.35/0.001)
---^
C:\Program Files\Microsoft Visual Studio\MyProjects\tu11\tu11.f90(20) : Error: An INTEGER or REAL data type is required in this context. [I]
do i=1,int(0.35/0.001)
---^
C:\Program Files\Microsoft Visual Studio\MyProjects\tu11\tu11.f90(22) : Error: This name does not have a type, and must have an explicit type. [DALTF]
daltf=daltf+0.001
-^
Error executing df.exe.
tu11.obj - 5 error(s), 0 warning(s) |
|