how to multiply each of the array with another set of array

조회 수: 6 (최근 30일)
Grace
Grace 2014년 5월 6일
답변: Mischa Kim 2014년 5월 6일
Hi everyone, suppose i have a=1,2,3,4 and j=1,2,3 I want to get 1^1, 1^2, 1^3, 2^1, 2^2, 2^3, 3^1, 3^2, 3^3, 4^1, 4^2 and 4^3. How can i go this?

채택된 답변

Mischa Kim
Mischa Kim 2014년 5월 6일
Grace, use
a = [1,2,3,4];
j = [1,2,3]';
b = bsxfun(@power,a,j);

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Matrices and Arrays에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by