Creating vectors with components

11 次查看(过去 30 天)
How do I create a 5-element column vector whose components are the squares of the elements of vector Row
  2 个评论
David Hill
David Hill 2019-9-21
Look at transpose and basic matrix operations
Walter Roberson
Walter Roberson 2019-9-21
What do you want to do if the vector Row is not exactly 5 elements long ?

请先登录,再进行评论。

回答(1 个)

Bruno Luong
Bruno Luong 2019-9-21
r=[3 2 7 5 2]
r(1:min(5,end)).^2.'
or
r(1:min(5,end)).'.^2

类别

Help CenterFile Exchange 中查找有关 Shifting and Sorting Matrices 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by