Add an increment to a matrix [1x50]

1 view (last 30 days)
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

Accepted Answer

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

More Answers (0)

Community Treasure Hunt

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

Start Hunting!