展开全部
program main
implicit none
real*8,allocatable::a(:)
integer::i
a=linspace( 0.0d0, 1.0d0, 10)
do i=1,size(a)
write(*,*)a(i)
enddo
read(*,*)
contains
function linspace(a,b,n)result(x)
implicit none
real*8,allocatable::x(:)
real*8,intent(in)::a,b
integer,intent(in)::n
integer::i
allocate(x(n+1))
x=(/(i,i=0,n)/)*1.0d0/n*(b-a)+a
end function linspace
end program main
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询