hold value of multiplication of two scalar vector

조회 수: 1 (최근 30일)
Arijet Sarker
Arijet Sarker 2018년 6월 24일
편집: Stephen23 2018년 6월 24일
gamma = [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1] tao = [0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1]
for i = 1:10
for j = 1:10
lm = gamma(i) * tao(j)
end
end
I want all the values of gamma * tao in lm variable. But, I am only getting lm=1.

답변 (1개)

Stephen23
Stephen23 2018년 6월 24일
편집: Stephen23 2018년 6월 24일
Simpler (for R2016b and later):
gamma(:) .* tao
or for older versions:
bsxfun(@times,gamma(:),tao)

카테고리

Help CenterFile Exchange에서 Gamma Functions에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by