Borrar filtros
Borrar filtros

Matrix summation within a loop

1 visualización (últimos 30 días)
Keshav Dev Singh
Keshav Dev Singh el 18 de Feb. de 2012
Hello Friends, I want to solve "Phi=Summation((1/ai^2)*V(:,i)*U(:,i)') for loop range i=1:100". At every iteration Phi is a 100x500 huge matrix.
How such huge matrix summation problem can be solve?
Any and all replies are really appreciated!
~Keshav

Respuesta aceptada

Andrei Bobrov
Andrei Bobrov el 18 de Feb. de 2012
Phi2 = zeros(size(V,2),size(U,1));
for j1 = 1:size(V,2)
Phi2(j1,:) = 1/ai^2*sum(V(:,j1)*U(:,j1).');
end
OR
without loop
Phi1 = 1/ai^2*sum(bsxfun(@times,permute(V,[2 3 1]),U.'),3)

Más respuestas (1)

Keshav Dev Singh
Keshav Dev Singh el 18 de Feb. de 2012
It's working. Thanks a lot Bobrov!
One think i m nt getting, whts is meaning of dot in "U." ?
Regards, KDSingh

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by