Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我需要将列表向量乘以矩阵列表。目前我正在使用 for 循环进行操作:
for k=1:N x(:,k)= A(:,:,k) \ b(:,k); end
我可以在没有for循环的情况下写这个吗?
for
如果您真的在寻找解决方案(可能会更慢;您需要分析),我会将矩阵存储在一个单元格数组中(例如A(:,:,k) = A{k})。然后:
A(:,:,k) = A{k}
x = reshape( blkdiag(A{:})\b(:) , numel(b)/N, N );