As you will be able to tell I am relatively new to Matlab. I have created an array "xrange" with 1 row, 99 elements. It has values ranging from around -7 to 3.5. UI(,) is a matrix of zeroes, which I am trying to fill the first column of using the loop below (N is a pre specified integer), where alpha = 0.25. Everytime I try to do this, i get the error stated in the question title. Please could someone give me some advice on where I may be going wrong?
for j = 1:N-1
UI(j,0) = exp(-alpha*xrange(j))*max(exp(xrange(j)) - K,0);
UI(j,0) = exp(-alpha*xrange(j))*max(exp(xrange(j))-K,0);
Index in position 2 is invalid. Array indices must be positive integers or logical values.
Any help would be hugely appreciated, Thanks