Matrix in matlab equation
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Amy Topaz
am 12 Mär. 2022
Kommentiert: Amy Topaz
am 12 Mär. 2022
A = 1*1000 matrix
I need another matrix Y which has all the rows as A
Y = 1000*1000 matrix
How to do that??
0 Kommentare
Akzeptierte Antwort
Weitere Antworten (1)
John D'Errico
am 12 Mär. 2022
Bearbeitet: John D'Errico
am 12 Mär. 2022
An alternative to repmat is to use a dot product (if you are an old APL person like me, then the phrase "outer product" will come to mind.) Thus, if A is a 1x1000 vector, then
B = ones(1000,1)*A;
B will be a matrix that has rows identical to A, with 1000 copies thereof.
Similarly, if you instead want columns that are copies of the row vector A, you can do this:
C= A.'*ones(1,1000);
C will be a 1000x1000 matrix, with columns given as A, and 1000 such columns.
Note my use of the .' operator there, since if you use the ' operator instead, then it will form the conjugate transpose if A had any complex or purely imaginary elements.
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!