Is it possible to put array index as zero in matlab?
显示 更早的评论
I have boundary value problem in heat transfer. My boundary point starts from 1. However due to the finite difference approximation of derivatives when applying equations at the boundaries the finite difference equation will encounter one point outside the boundary i.e. point zero. I specified the value of the point, however matlab shows error that matrix index should be positive and logical. Does that mean in matlab array index cannot start from zero? If yes, is there a workaround for this, so that I can avoid redefining by boundary points as 1 and restructuring my total program?
采纳的回答
更多回答(1 个)
Vishal Rane
2013-9-25
0 个投票
Indexing does indeed start from 1, but you can modify the indexing in your logic to map the required 0th index to the actual 1st index in the matrix/array
1 个评论
hardik pandya
2020-8-7
Hello sir, could you please explain in matlab code how to do it.
类别
在 帮助中心 和 File Exchange 中查找有关 Matrix Indexing 的更多信息
产品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!