Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/84.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Fortran 错误:参数列表中(1)处的语法错误_Fortran_Gfortran - Fatal编程技术网

Fortran 错误:参数列表中(1)处的语法错误

Fortran 错误:参数列表中(1)处的语法错误,fortran,gfortran,Fortran,Gfortran,错误: implicit none character*20 fflname, oflname, oflname2 integer i, length, rn, s(100) real*8 phase_shift parameter ( length = 32768, phase_shift = 0.02 ) real*8 num, real_coeff, imag_coe

错误:

       implicit none
       character*20 fflname, oflname, oflname2
       integer      i, length, rn, s(100)
       real*8       phase_shift
       parameter    ( length = 32768, phase_shift = 0.02 )
       real*8       num, real_coeff, imag_coeff
       real*8       amplitude(length), phase(length)
      &            ,imag_coeff_ps(length), real_coeff_ps(length)

       oflname = "wvlt_coeff.data"
       oflname2 = "selection.data"
       fflname = "wvlt_coeff_ps.data"
       open(12, file = oflname)
       do i=1, length
          read(12, *) num, real_coeff, imag_coeff
          real_coeff_ps(i) = real_coeff
          imag_coeff_ps(i) = imag_coeff
       enddo
       close(12)
       open(13, file = oflname2)
       do i=1, 100
          read(13, *) rn
          s(i) = rn
       enddo   
       close(13)    

       do i=1, 100
          amplitude(i) = sqrt( real_coeff(s(i))**2 + imag_coeff(s(i))**2 )
          phase(i) = atan( imag_coeff(s(i))/real_coeff(s(i)) ) + phase_shift
          real_coeff_ps(s(i)) = amplitude(i) * cos( phase(i) )
          imag_coeff_ps(s(i)) = amplitude(i) * sin( phase(i) )
       enddo

       open(15, file = fflname)
       do i=1, length
          write(15, *) i, real_coeff_ps(i), imag_coeff_ps(i)
       enddo
       close(15)

       stop
       end

我的编码有什么问题?

real\u coeff
image\u coeff
不是数组,但您正在访问它们,就好像它们是数组一样。这会导致语法错误。也许您打算改用
real\u coeff\u ps
image\u coeff\u ps

real\u coeff和imag\u coeff声明为标量,但它们在错误中用作数组。也许你打算使用“_ps”变量?你可能注意到有几个人不喜欢你的问题。请阅读有关如何提问的帮助页面。文本中应该有一些真正的问题,而不仅仅是代码和错误消息。标题应该描述你的实际问题。这与你是初学者无关,你应该描述你的问题。谢谢你的评论。衷心感谢
hyxie@ubuntu:~$ gfortran '/home/hyxie/Documents/20161012/phase_shift2.f' 
/home/hyxie/Documents/20161012/phase_shift2.f:35:40:

          amplitude(i) = sqrt( real_coeff(s(i))**2 + imag_coeff(s(i))**2 )
                                        1
Error: Syntax error in argument list at (1)
/home/hyxie/Documents/20161012/phase_shift2.f:36:36:

          phase(i) = atan( imag_coeff(s(i))/real_coeff(s(i)) ) + phase_shift
                                    1
Error: Syntax error in argument list at (1)