フィルターのクリア

how to multiply a matrix with scalar ?

2 ビュー (過去 30 日間)
kitty varghese
kitty varghese 2017 年 9 月 14 日
編集済み: per isakson 2017 年 9 月 14 日
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 件のコメント
Stephen23
Stephen23 2017 年 9 月 14 日
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);

サインインしてコメントする。

採用された回答

KSSV
KSSV 2017 年 9 月 14 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeRead, Write, and Modify Image についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by