Add an increment to a matrix [1x50]

2 次查看(过去 30 天)
Kindly some friendly hints are requested!
I have a matrix [1 x 50] with values of velocity inside starting from 20 m/s to 0m/s. I want to change the increment of the values inside the matrix by 0.5 from 20 m/s until 10 m/s and add another increment of 1.5 from 9 m/s to 0 m/s.
I have written the following code but still struggling.
for i=50
velocity_temp=[20:0.5:10]
else
velocity_temp=[9:1.5:0]
end

采纳的回答

David Hill
David Hill 2021-4-5
velocity_temp=[20:-.5:9,7.5:-1.5:0];

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Matrix Indexing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by