in the following example, I get error when I want to simulate.
R1=(2e-3)*[0 3 0
0 2 0
0 1 0
0 0 0
0 -1 0
0 -2 0
0 -3 0];
R2=(5e-3)*[0 3 0
0 2 0
0 1 0
0 0 0
0 -1 0
0 -2 0
0 -3 0];
R3=(5e-3)*[0 3+0.3*randn() 0
0 2+0.3*randn() 0
0 1+0.3*randn() 0
0 0+0.3*randn() 0
0 -1+0.3*randn() 0
0 -2+0.3*randn() 0
0 -3+0.3*randn() 0];
hold on
phases=[0 0 0 0 0 0 0];
phi=90;
AF_tot=zeros(1,1802);
for theta=-90:0.1:90
AF_tot(theta*10+901)=Array_beam_cal(R3,phases,theta,phi);
end
global_theta=-90:0.1:90;
plot(global_theta,AF_tot,'linewidth',1.5);
xlabel('theta(degree)');
ylabel('array factor');
Error is:
Array indices must be positive integers or logical values.
Noticing my example code, all indexes in "AF_tot(theta*10+901)" are positive. If I change part of previous code to following one:
AF_tot=zeros(1,181);
for theta=-90:90
AF_tot(theta+91)=Array_beam_cal(R3,phases,theta,phi);
end
error does not occur.