Hi Tarun,
I understand that you are encountering the "Index exceeds array bounds" error while executing the shared script. This issue occurs in the following segment of the code:
for i = 2:n
M(i, j) = 1 - (1 - a) * alpha * (1 - exp((-alpha / (i1 * Yw) * (U(i+1, j) - U(i-1, j)) / (2 * dz))));
end
The error arises because the loop iterates from `i = 2` to `n`, while the matrix `U` has a size of `n`. Therefore, attempting to access the element at the `i+1` index exceeds the array bounds.
To address this issue, you may either increase the size of the matrix `U` by 1 or adjust the loop to iterate until `n-1`, depending on what best suits your requirements.
Hope this helps!