creating a matrix from vector
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
madhan ravi
2020-8-28
编辑:madhan ravi
2020-8-28
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 个评论
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Startup and Shutdown 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!