creating a matrix from vector
10 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Aleksandra Ksiezyk
le 28 Août 2020
Commenté : madhan ravi
le 28 Août 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
0 commentaires
Réponse acceptée
madhan ravi
le 28 Août 2020
Modifié(e) : madhan ravi
le 28 Août 2020
https://www.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html You already almost gave the answer to your question:
Ta(:) + (k(:).' .* (1:31))
%Or
bsxfun(@plus, Ta(:), bsxfun(@times, k(:).', 1:31))
2 commentaires
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!