matrix multiplication with different sizes

i have two arrays of sizes n and n*k i want to multiply the the first element of first matrix with first k elements and so on.

댓글 수: 2

"so on"
How exactly do you want to proceed? Multipy with the next k elements or the second element from first matrix? Give us an example with the following (n=4, k=5) -
y=spiral(4) %4*4 matrix
y = 4×4
7 8 9 10 6 1 2 11 5 4 3 12 16 15 14 13
z=reshape(1:4*5,4,5) %4*5 matrix
z = 4×5
1 5 9 13 17 2 6 10 14 18 3 7 11 15 19 4 8 12 16 20
kriti
kriti 2022년 7월 11일
first element with first k
second element with second k like that

댓글을 달려면 로그인하십시오.

 채택된 답변

Hrusheekesh
Hrusheekesh 2022년 7월 11일

0 개 추천

hi kriti can you try this
x=repelem(a,k);
b=b.*x;

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Resizing and Reshaping Matrices에 대해 자세히 알아보기

질문:

2022년 7월 11일

댓글:

2022년 7월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by