Filter löschen
Filter löschen

how to multiply a matrix with scalar ?

2 Ansichten (letzte 30 Tage)
kitty varghese
kitty varghese am 14 Sep. 2017
Bearbeitet: per isakson am 14 Sep. 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 Kommentar
Stephen23
Stephen23 am 14 Sep. 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);

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

KSSV
KSSV am 14 Sep. 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

Weitere Antworten (0)

Kategorien

Mehr zu Read, Write, and Modify Image finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by