필터 지우기
필터 지우기

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 CenterFile Exchange에서 Read, 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