Make the vector lin=[1 2 3 ⋯ 20] (the integers from 1 to 20), and then make every other value in it negative to get lin=[1 −2 3 −4 ⋯ −20] . what is the MATLAB code?
33 次查看(过去 30 天)
显示 更早的评论
lin=[1:20]
then?
0 个评论
采纳的回答
Matt J
2015-7-11
lin(2:2:end)=-lin(2:2:end)
1 个评论
Orbay Altuntoprak
2016-2-27
Having looked through google for the answer to the question stated above, I was very delighted to find your answer. Thank you.
更多回答(1 个)
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!