How to construct this matrix without using two for loops?
2 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hi, I'm trying to construct a matrix in the following manner:
sz=10;
V=rand(sz,sz);
X=rand(sz,sz);
for iter1=1:sz
for iter2=1:sz
A(iter1,iter2) = sum((V(:,iter1)*V(:,iter2)').*X,[1 2]);
end
end
Is there a way to do this without for-loops? I'm sure there must be a way that I haven't been able to think of!
2 commentaires
Réponses (1)
Voir également
Catégories
En savoir plus sur Search Path dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!