I have a segment of code, that has been running fine for a while.
I got a stack overflow error when run with large arrays.
Here is the code:
xa = [x(1:n-1)-x(n), x, x(2:n)+x(n)] <<<< Stack over flow on this line
In the stack overflow case, n=44836 and na=134506
If i cange the code to this it will run:
xa(:n-1) = x(:n-1)-x(n)
xa(n:2*n-1) = x
xa(2*n:3*n-2) = x(2:)+x(n)
Is the latter the preferable method?
Are the pieces in the brackets assembled on the stack, thus the stack overflow?
Should i increase the stack size?