Azzera filtri
Azzera filtri

how to multiply a matrix with scalar ?

2 visualizzazioni (ultimi 30 giorni)
kitty varghese
kitty varghese il 14 Set 2017
Modificato: per isakson il 14 Set 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 Commento
Stephen23
Stephen23 il 14 Set 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);

Accedi per commentare.

Risposta accettata

KSSV
KSSV il 14 Set 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

Più risposte (0)

Categorie

Scopri di più su Read, Write, and Modify Image in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by