矩阵的维度一直是错的,但不知道怎么改,求助
integer::Nreal*8,allocatable,dimension(:,:)::a,b,c,y,f,d
allocate(f(n,2))
allocate(y(n,2))
allocate(a(n,n))
allocate(b(n,n))
allocate(c(n,n))
allocate(d(n,1))
f(:,1)=y(:,2) !dy1/dt=y2
f(:,2)=matmul(a,(-matmul(b,y(:,2))-matmul(c,y(:,1))+d)) !dy2/dt=a*(-b*y2-c*y1+d)The shapes of the array expressions do not conform.
f(:,2) 改为 f(:,2:2) 就好了
f(:,:) 和 f 是二维数组
f(2,2) 是单变量
f(:,2) 是一维数组
f(:,2:2) 是 N*1 的二维数组
fcode 发表于 2016-2-8 12:44
f(:,2) 改为 f(:,2:2) 就好了
f(:,:) 和 f 是二维数组
谢谢老大!
页:
[1]