i want implement the a gaussian Input in rectangle form and in circle form, sorry i dont know why first a worked, but seconed a not. The error is: ''Array indices must be positive integers or logical values''. Can someone help me
x = -L_x/2 :dx_coarse : L_x/2;
y = -L_y/2 :dy_coarse : L_y/2;
n = ones(length(y),length(x))*n_glass;
GaussInput = 1*exp(-xg1.^2/(2*(sigma_x))^2 -yg1.^2/(2*(sigma_y))^2);
Excitation.coup_center = [y((length(y)+1)/2 + y_coupcenter*1e6),x((length(x)+1)/2 + x_coupcenter*1e6)];
Excitation.gausscoup = sqrt((xg(:,:,1)-Excitation.coup_center(2)).^2+(yg(:,:,1)-Excitation.coup_center(1)).^2)<=rad_coup;
a = GaussInput(Excitation.gausscoup);
Excitation.gausscoup = zeros(length(y),length(x));
Excitation.gausscoup((n_dim(1)+1)/2 - y_coupcenter*1e6 - length/(2*dy_coarse*1e6): (n_dim(1)-1)/2 - y_coupcenter*1e6 + length/(2*dy_coarse*1e6), (n_dim(2)+1)/2 - x_coupcenter*1e6 - width/(2*dx_coarse*1e6) :(n_dim(2)-1)/2 - x_coupcenter*1e6 + width/(2*dx_coarse*1e6)) = 1;
a = GaussInput(Excitation.gausscoup);