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!