|
我要求A1,A3,可是只有含有A1,A3的表达式A,B,C,D的关系式,编程如下,求大师指导
[Fortran] 纯文本查看 复制代码 program tu2
use IMSL
implicit none
external FCN
real*8 FCN
real,parameter::ERRREL=0.0001
integer,parameter::N=2
integer,parameter::ITMAX=100
real*8::XGUESS(N)=(/0.0467,0.0732/)
real X(N),FNORM
real*8 A1,A2,A3,A,B,C,D
real*8 Z0,Zi
real*8 E,F
real,parameter::pi=3.14159
integer,parameter::Zrs=5
integer,parameter::A4s=9
integer k,i
real*8::Zr(Zrs)=(/1.0,2.0,3.0,4.0,5.0/)
real*8::A4(A4s)=(/0.075,0.10,0.15,0.20,0.25,0.30,0.35,0.40,0.425/)
common /group2/ zi
common /group3/ A2
!!**************************************************
Zi=-3.0 !!天线阻抗虚部的值
Z0=50.0 !!传输线的特性阻抗
A2=0.25 !!第二个支节的长度
!!***************************************************
do i=1,Zrs
do k=1,A4s
call NEQNF(Zr(i),A4(k),FCN(i,k),ERRREL,N,ITMAX,XGUESS,X,FNORM)
write(*,*) X
stop
end
!!!**************************
subroutine A4_get_A(A4,A)
implicit none
real*8 A2,A3,A4,A
real,parameter::pi=3.14159
common /group3/ A2
A=cos(2.0*pi*A2)*cos(2.0*pi*A4)-sin(2.0*pi*A2)*(-cos(2.0*pi*A4)/tan(2.0*pi*A3)+sin(2.0*pi*A4)) !!A的函数式
return
end
!!!***************************
subroutine A4_get_B(A4,B)
implicit none
real*8 A2,A3,A4,z0,B
real,parameter::pi=3.14159
common /group3/ A2
common /group1/ Z0
B=Z0*(cos(2.0*pi*A2)*sin(2.0*pi*A4)+sin(2.0*pi*A2)*(sin(2.0*pi*A4)/tan(2.0*pi*A3)+cos(2.0*pi*A4))) !!B的函数式
return
end
!!*****************************
subroutine A4_get_C(A4,C)
implicit none
real*8 A1,A2,A3,A4,Z0,C
real,parameter::pi=3.14159
common /group3/ A2
common /group1/ Z0
C=1.0/Z0*(cos(2.0*pi*A4)*((-cos(2.0*pi*A2))/tan(2.0*pi*A1)+sin(2.0*pi*A2))+(sin(2.0*pi*A2)/tan(2.0*pi*A1)+cos(2.0*pi*A2))*((-cos(2.0*pi*A4))/tan(2.0*pi*A3)+sin(2.0*pi*A4)))
return
end
!!*******************************
subroutine A4_get_D(A4,D)
implicit none
real*8 A1,A2,A3,A4,D
real,parameter::pi=3.14159
common /group3/ A2
D=-sin(2.0*pi*A4)*(-cos(2.0*pi*A2)/tan(2.0*pi*A1)+sin(2.0*pi*A2))+(sin(2.0*pi*A2)/tan(2.0*pi*A1)+cos(2.0*pi*A2))*(sin(2.0*pi*A4)/tan(2.0*pi*A3)+cos(2.0*pi*A4))
return
end
!!****************************************************
subroutine FCN(A,B,C,D,A4,Zr,XA,F,N)
implicit none
integer N
real,target::XA(N)
real F(N)
real,pointer::A1,A3
real*8 A,B,C,D,A4,Z0,Zr,Zi
common /group1/Z0
common /group2/Zi
A1=>XA(1)
A3=>XA(2)
call A4_get_A(A4,A)
call A4_get_B(A4,B)
call A4_get_C(A4,C)
call A4_get_D(A4,D)
F(1)=A*D+B*C-Z0*((D-C*Zi)*(D-C*Zi)+(C*Zr)*(C*Zr))
F(2)=(D*A-B*C)*Zi-A*C*(Zr*Zr+Zi*Zi)+D*B
return
end
以下是错误指示
Compiling Fortran...
C:\Program Files\Microsoft Visual Studio\MyProjects\tu2\tu2.f90
C:\Program Files\Microsoft Visual Studio\MyProjects\tu2\tu2.f90(29) : Error: The number of actual arguments cannot be greater than the number of dummy arguments. [NEQNF]
call NEQNF(Zr(i),A4(k),FCN(i,k),ERRREL,N,ITMAX,XGUESS,X,FNORM)
------^
C:\Program Files\Microsoft Visual Studio\MyProjects\tu2\tu2.f90(29) : Error: The type of the actual argument differs from the type of the dummy argument. [A4]
call NEQNF(Zr(i),A4(k),FCN(i,k),ERRREL,N,ITMAX,XGUESS,X,FNORM)
------------------^
C:\Program Files\Microsoft Visual Studio\MyProjects\tu2\tu2.f90(29) : Error: The type of the actual argument differs from the type of the dummy argument. [FCN]
call NEQNF(Zr(i),A4(k),FCN(i,k),ERRREL,N,ITMAX,XGUESS,X,FNORM)
------------------------^
C:\Program Files\Microsoft Visual Studio\MyProjects\tu2\tu2.f90(29) : Error: The type of the actual argument differs from the type of the dummy argument. [0.0001]
call NEQNF(Zr(i),A4(k),FCN(i,k),ERRREL,N,ITMAX,XGUESS,X,FNORM)
---------------------------------^
C:\Program Files\Microsoft Visual Studio\MyProjects\tu2\tu2.f90(29) : Error: The type of the actual argument differs from the type of the dummy argument. [2]
call NEQNF(Zr(i),A4(k),FCN(i,k),ERRREL,N,ITMAX,XGUESS,X,FNORM)
----------------------------------------^
C:\Program Files\Microsoft Visual Studio\MyProjects\tu2\tu2.f90(29) : Error: The type of the actual argument differs from the type of the dummy argument. [100]
call NEQNF(Zr(i),A4(k),FCN(i,k),ERRREL,N,ITMAX,XGUESS,X,FNORM)
------------------------------------------^
C:\Program Files\Microsoft Visual Studio\MyProjects\tu2\tu2.f90(29) : Error: The type of the actual argument differs from the type of the dummy argument. [XGUESS]
call NEQNF(Zr(i),A4(k),FCN(i,k),ERRREL,N,ITMAX,XGUESS,X,FNORM)
------------------------------------------------^
C:\Program Files\Microsoft Visual Studio\MyProjects\tu2\tu2.f90(29) : Error: This actual argument must be the name of a user subroutine or the name of intrinsic subroutine. [ZR]
call NEQNF(Zr(i),A4(k),FCN(i,k),ERRREL,N,ITMAX,XGUESS,X,FNORM)
------------^
C:\Program Files\Microsoft Visual Studio\MyProjects\tu2\tu2.f90(29) : Error: The shape matching rules of actual arguments and dummy arguments have been violated. [XGUESS]
call NEQNF(Zr(i),A4(k),FCN(i,k),ERRREL,N,ITMAX,XGUESS,X,FNORM)
------------------------------------------------^
C:\Program Files\Microsoft Visual Studio\MyProjects\tu2\tu2.f90(28) : Error: An unterminated block exists.
do k=1,A4s
^
C:\Program Files\Microsoft Visual Studio\MyProjects\tu2\tu2.f90(27) : Error: An unterminated block exists.
do i=1,Zrs
^
Error executing df.exe.
tu2.obj - 11 error(s), 0 warning(s)
在此谢过!!
|
|