Creating a matrix with for loop
显示 更早的评论
I need to create a matrix that increases or decreases in size with the change in variable n. The matrix should be having only one column and the number of rows need to change with the n value.
The inputs are n, (dx=L/n), L. The matrix that needs to be created should be [0;dx/2;(dx/2+dx);((dx/2+dx)+dx);(((dx/2+dx)+dx)+dx);.....;0.5].
The fourth value of the matrix is simply the third value +dx, this should go on until it reaches 0.5. I can't seem to work out how to make a for loop for this problem.
The number of values in between 0 and 0.5 should also be equal to the n value, so if the n value is 8 the number of values in between should also be 8.
采纳的回答
更多回答(0 个)
类别
在 帮助中心 和 File Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!