how to get plus and minus sign element of matrix at the same time?
조회 수: 2 (최근 30일)
이전 댓글 표시
I have a matrix like n=[x,y,z] I need to consider plus and minus sign of x,y and z "at the same time" because I need unique permutation of mix signs as well s.t. [-x,y,z],[x,-y,-z],etc.
댓글 수: 0
답변 (1개)
Sean de Wolski
2013년 5월 16일
[xx yy zz] = meshgrid(-1:1);
[xx(:) yy(:) zz(:)]
?
댓글 수: 2
Sean de Wolski
2013년 5월 16일
That was just to demonstrate, if you don't want zeros:
meshgrid([-2 -1 1 2]);
If you have x y and z, this is equivalent to:
meshgrid([-x -y -z x y z]);
참고 항목
카테고리
Help Center 및 File Exchange에서 Startup and Shutdown에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!