how to zero pad a matrix?
조회 수: 4 (최근 30일)
이전 댓글 표시
hi,
my input matrix "x" is a 3X1 matrix.
and i'm using it in the formula
r=x^t (t is some value)
but it is asking for a square matrix or a scalar value.
so, how to convert that 3X1 matrix to 3X3 square matrix by padding zeroes.
please suggest, thanks in advance
댓글 수: 0
채택된 답변
dpb
2015년 1월 2일
More than likely you're actually looking for the "dot" operator .^ to return the element-wise values of the vector x I'd venture...but, if you really are intent on turning into an array, simply
[x zeros(length(x),length(x)-1)]^t
is the generic expression (but I still don't think that's what you intend/want).
댓글 수: 0
추가 답변 (1개)
Star Strider
2015년 1월 2일
편집: Star Strider
2015년 1월 2일
You likely need to use element-wise operations:
r=x.^t;
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Logical에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!