General Binomial Matrix Manipulation

조회 수: 1 (최근 30일)
Alexander Pakakis
Alexander Pakakis 2019년 9월 3일
댓글: Alexander Pakakis 2019년 9월 3일
Let's say I have a matrix of the form:
Starting from this matrix, I would like to calculate a new matrix, in a time efficient way:
The algorithm, which I am looking for, should also work for a matrix of the form:
Does someone know how this algorithm could look like?
Best
Alex
  댓글 수: 2
Akira Agata
Akira Agata 2019년 9월 3일
Assuming Astart is n-by-2 array, straight-forward way to calculate Aend would be:
Aend = [Astart(:,1).^2 Astart(:,1).*Astart(:,2) Astart(:,2).*Astart(:,1) Astart(:,2).^2];
But it's not clear for me what Aend looks like when Astart is n-by-m array.
Could you explain more detail on this?
Alexander Pakakis
Alexander Pakakis 2019년 9월 3일
of course, I can explain more!
Let's say I have:
then I would like to calculate this matrix:
I think, you will understand the system when see this table:
Example.JPG

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

채택된 답변

Matt J
Matt J 2019년 9월 3일
편집: Matt J 2019년 9월 3일
[m,n]=size(Astart);
B=reshape(Astart,m,1,n).*Astart;
Aend=reshape(B,m,[]);

추가 답변 (1개)

Andrei Bobrov
Andrei Bobrov 2019년 9월 3일
편집: Andrei Bobrov 2019년 9월 3일
Aend = reshape(Abegin.*permute(Abegin,[1,3,2]),size(Abegin,1),[]);
  댓글 수: 1
Alexander Pakakis
Alexander Pakakis 2019년 9월 3일
works perfectly!
Thank you Andrei!

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

카테고리

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

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by