how to zero pad a matrix?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentare
Akzeptierte Antwort
dpb
am 2 Jan. 2015
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 Kommentare
Weitere Antworten (1)
Star Strider
am 2 Jan. 2015
Bearbeitet: Star Strider
am 2 Jan. 2015
You likely need to use element-wise operations:
r=x.^t;
0 Kommentare
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!