小编Jay*_*uch的帖子

“类型错误:‘函数’对象不支持项目分配”

我有两个矩阵

fi = [[f1],           Nij = [[N11 N12 .......N1n],
      [f2],                  [N21 N22 .......N2n],
       .                            ...
       .                            ...
      [fn]]                  [Nn1 Nn2 .......Nnn]]
Run Code Online (Sandbox Code Playgroud)

我想乘:

f1 to each element of the 1st row,
f2 to each element of the 2nd row,
Run Code Online (Sandbox Code Playgroud)

等等。

即我想要Xij = fi*Nij其中 fi 是一个列矩阵,而 Xij & Nij 是 nxn 矩阵。

我尝试使用

import numpy as np

fi = np.linspace(1,5, num =5)
fi = np.asmatrix(fi)

def Xij(ai):
    Nij = np.ones((5,5))
    for i in range(len(fi)):
    for j in range(len(fi)):
        Xij[i,j] = …
Run Code Online (Sandbox Code Playgroud)

python iteration typeerror

4
推荐指数
1
解决办法
2万
查看次数

标签 统计

iteration ×1

python ×1

typeerror ×1