Please note: MATLAB allows positive array indices only, examples
data(-2); % Invalid
data(0); % Invalid
data(4); % Valid
Whatever you do during array indexing, please make sure that within "()", there should be a positive integer values only such as 1,2,3,….
In the code, as you have shared, in the first iteration of the loop
N0=fs/3; %Which approximately equal to 66.67
For the iteration, once the "j" reach to 67, then "if condition" becomes true, in that case:
for j=1:j_max+1
...
if j>N0
Ac(j-N0)=....
end
end
Here
A(67-N0)
A(67-66.66)
%.. ^= is no a positive integer
Hope you get the points of error. Hence requested to do the coding in such a way that, which only generates positive values with array indexing.
:)