fortran语言如何从文件读入数据
一物理系统可用下列线性方程组来表示:从文件中读入m1、m2和θ的值,求a1、a2、N1和N2的值。方程:m1cosθ-m1-sinθ0a10m1sinθ0cosθ0a2m...
一物理系统可用下列线性方程组来表示:
从文件中读入m1、m2和θ的值,求a1、a2、N1 和N2的值。
方程:m1cosθ -m1 -sinθ 0 a1 0
m1sinθ 0 cosθ 0 a2 m1g
0 m2 -sinθ 0 N1 0
0 0 -cosθ 1 N2 m2g 展开
从文件中读入m1、m2和θ的值,求a1、a2、N1 和N2的值。
方程:m1cosθ -m1 -sinθ 0 a1 0
m1sinθ 0 cosθ 0 a2 m1g
0 m2 -sinθ 0 N1 0
0 0 -cosθ 1 N2 m2g 展开
3个回答
展开全部
一物理系统可用下列线性方程组来表示:
从文件中读入m1、m2和θ的值,求a1、a2、N1 和N2的值。方程:m1cosθ -m1 -sinθ 0 a1 0
m1sinθ 0 cosθ 0 a2 m1g
0 m2 -sinθ 0 N1 0
0 0 -cosθ 1 N2 m2gFORTRAN语言是Formula Translation的缩写,意为"公式翻译"。它是为科学、工程问题或企事业管理中的那些能够用数学公式表达的问题而设计的,其数值计算的功能较强。
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
Open打开文件
Read(文件号,格式串)变量列表
具体的可以看看帮助文件:)
Read(文件号,格式串)变量列表
具体的可以看看帮助文件:)
本回答被网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
源程序如下:
SUBROUTINE ForceDLL(time,x,xdot,xdot2,amat,omega,omegadot,F,M)
!DEC$ ATTRIBUTES DLLEXPORT::ForceDLL
!DEC$ ATTRIBUTES ALIAS:'forcedll' :: ForceDLL
! input
DOUBLE PRECISION ,INTENT(IN) :: time ! time
DOUBLE PRECISION ,DIMENSION(3) ,INTENT(IN) :: x ! global position of reference node
DOUBLE PRECISION ,DIMENSION(3) ,INTENT(IN) :: xdot ! global velocity of reference node
DOUBLE PRECISION ,DIMENSION(3) ,INTENT(IN) :: xdot2 ! global acceleration of reference node !
DOUBLE PRECISION ,DIMENSION(3),INTENT(IN) :: omega ! angular velocity of reference node (global base)
DOUBLE PRECISION ,DIMENSION(3) ,INTENT(IN) :: omegadot ! angular acceleration of reference node (global base)
DOUBLE PRECISION ,DIMENSION(3,3),INTENT(IN) :: amat ! rotation matrix (body -> global)
! output
DOUBLE PRECISION ,DIMENSION(3) ,INTENT(OUT) :: F ! External force in reference node (global base)
DOUBLE PRECISION ,DIMENSION(3) ,INTENT(OUT) :: M ! External moment in reference node (global base)
!
INTEGER :: I,J,K,N, L ! generic counter for the time step
real,allocatable :: Force(:,: ) ! read data from external file
!
N=floor(time/0.001)+1
write (*,*) N
allocate(Force(7,N))
open(20, FILE="Fbrk.txt" )
!!! read the external file into an array
do I=1,N
read (20,*) Force(:,I)
end do
close (20)
K=floor(time/0.001)+1
open(300, FILE="data.txt" )
write (300,'(I3,I10/)') N
!
!
!
F(1)=Force(2,K)*1000.0
F(2)=Force(3,K)*1000.0
F(3)=Force(4,K)*1000.0
M(1)=Force(5,K)*1000.0
M(2)=Force(6,K)*1000.0
M(3)=Force(7,K)*1000.0
END SUBROUTINE ForceDLL
SUBROUTINE ForceDLL(time,x,xdot,xdot2,amat,omega,omegadot,F,M)
!DEC$ ATTRIBUTES DLLEXPORT::ForceDLL
!DEC$ ATTRIBUTES ALIAS:'forcedll' :: ForceDLL
! input
DOUBLE PRECISION ,INTENT(IN) :: time ! time
DOUBLE PRECISION ,DIMENSION(3) ,INTENT(IN) :: x ! global position of reference node
DOUBLE PRECISION ,DIMENSION(3) ,INTENT(IN) :: xdot ! global velocity of reference node
DOUBLE PRECISION ,DIMENSION(3) ,INTENT(IN) :: xdot2 ! global acceleration of reference node !
DOUBLE PRECISION ,DIMENSION(3),INTENT(IN) :: omega ! angular velocity of reference node (global base)
DOUBLE PRECISION ,DIMENSION(3) ,INTENT(IN) :: omegadot ! angular acceleration of reference node (global base)
DOUBLE PRECISION ,DIMENSION(3,3),INTENT(IN) :: amat ! rotation matrix (body -> global)
! output
DOUBLE PRECISION ,DIMENSION(3) ,INTENT(OUT) :: F ! External force in reference node (global base)
DOUBLE PRECISION ,DIMENSION(3) ,INTENT(OUT) :: M ! External moment in reference node (global base)
!
INTEGER :: I,J,K,N, L ! generic counter for the time step
real,allocatable :: Force(:,: ) ! read data from external file
!
N=floor(time/0.001)+1
write (*,*) N
allocate(Force(7,N))
open(20, FILE="Fbrk.txt" )
!!! read the external file into an array
do I=1,N
read (20,*) Force(:,I)
end do
close (20)
K=floor(time/0.001)+1
open(300, FILE="data.txt" )
write (300,'(I3,I10/)') N
!
!
!
F(1)=Force(2,K)*1000.0
F(2)=Force(3,K)*1000.0
F(3)=Force(4,K)*1000.0
M(1)=Force(5,K)*1000.0
M(2)=Force(6,K)*1000.0
M(3)=Force(7,K)*1000.0
END SUBROUTINE ForceDLL
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询