Borrar filtros
Borrar filtros

how to multiply a matrix with scalar ?

2 visualizaciones (últimos 30 días)
kitty varghese
kitty varghese el 14 de Sept. de 2017
Editada: per isakson el 14 de Sept. de 2017
I have 49 matrix which i call them as atom. I want to multiply each atom with a 49 different scalar value. ie atom1*h1+atom2*h2 .......atom49*h49.
A = rand(361,49);
B = reshape(A,19,19,1,49);
H = radn(49,1);
  1 comentario
Stephen23
Stephen23 el 14 de Sept. de 2017
Why not simply specify the final dimensions you require right from the start, rather than wasting time with reshape? This:
A = rand(361,49);
B = reshape(A,19,19,1,49);
should simply be:
B = rand(19,19,1,49);

Iniciar sesión para comentar.

Respuesta aceptada

KSSV
KSSV el 14 de Sept. de 2017
A = rand(361,49);
B = reshape(A,19,19,1,49);
H=rand(49,1);
A = zeros(19,19) ;
for i = 1:49
A = A+H(i)*B(:,:,1,i) ;
end

Más respuestas (0)

Categorías

Más información sobre Read, Write, and Modify Image en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by