I have a for loop that gives the values of x(n) — here n is an index.
d=0.5; x(1)=1; for n=2:10x(n)= x(n-1)+d;y(n)= log(abs(x(n)));fprintf('y(%d)=%d', n, y(n))end
I want the loop to also give the values of y(n) = log(abs(x(n))).
However, MATLAB doesn't seem to like this definition and I am presented with the error message: ??? Subscript indices must either be real positive integers or logicals.
What should I do to fix it?
Thanks.
Best Answer