Effacer les filtres
Effacer les filtres

how to multiply a matrix with scalar ?

2 vues (au cours des 30 derniers jours)
kitty varghese
kitty varghese le 14 Sep 2017
Modifié(e) : per isakson le 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 commentaire
Stephen23
Stephen23 le 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);

Connectez-vous pour commenter.

Réponse acceptée

KSSV
KSSV le 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

Plus de réponses (0)

Catégories

En savoir plus sur Read, Write, and Modify Image dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by