Devision of matrix by matrix

Hi, Please excuse total n00b here.
I am after devision of matrix by a second matrix, example;
x = [4; 8; 12; 16; 20];
y = [2 4];
I want x/y to give
ans = [2 1; 4 2; 6 3; 8 4; 10 5]
Thanks
Ad

 채택된 답변

the cyclist
the cyclist 2011년 10월 21일

0 개 추천

The bsxfun() command will automatically replicate arrays across the dimensions you need:
bsxfun(@rdivide,x,y)
I recommend reading "doc bsxfun" to get an understanding of the function.

댓글 수: 2

Scragmore
Scragmore 2011년 10월 21일
Thanks for the quick response. It was just what the doctor ordered. Yes I threw it straight at the help file to get more of an explanation.
Thanks again.
AD
Andrei Bobrov
Andrei Bobrov 2011년 10월 21일
x*(1./y)

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Operators and Elementary Operations에 대해 자세히 알아보기

질문:

2011년 10월 21일

Community Treasure Hunt

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

Start Hunting!

Translated by