creating a matrix from vector

1 Ansicht (letzte 30 Tage)
Aleksandra Ksiezyk
Aleksandra Ksiezyk am 28 Aug. 2020
Kommentiert: madhan ravi am 28 Aug. 2020
hej i have a vector Ta [12x1] and k [12x1] i would like to create a matrix [12,31] where the first column is Ta the second is Ta+k, the third is Ta+2k and so on till the end. can anyone help me with it or give any tip/hint

Akzeptierte Antwort

madhan ravi
madhan ravi am 28 Aug. 2020
Bearbeitet: madhan ravi am 28 Aug. 2020
Ta(:) + (k(:).' .* (1:31))
%Or
bsxfun(@plus, Ta(:), bsxfun(@times, k(:).', 1:31))
  2 Kommentare
Aleksandra Ksiezyk
Aleksandra Ksiezyk am 28 Aug. 2020
Test = Ta + (k .* (1:31)) - works perfectly... thank you a lot... i overthink and i started to writing some strange for loops
madhan ravi
madhan ravi am 28 Aug. 2020
By the way don’t ask the same question multiple times.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB 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!

Translated by