# Create a magnetic disc
for (i in 1:nrow(envM)){
for (j in 1:ncol(envM)){
if(sqrt((i-imageH/2)^2+(j-imageH/2)^2)>imageH/8 &
sqrt((i-imageH/2)^2+(j-imageH/2)^2)<imageH/6) envM[i,j]=5
}
}
if that is supposed to create a circle then it should use i-imageH and j-imageW something like
for (y in 1:nrow(envM)){
for (x in 1:ncol(envM)){
y2 = (y-imageH/2)
x2 = (x-imageW/2)
d = sqrt( x2*x2 + y2*y2 )
if( d >imageH/8 & d <imageH/6) envM[i,j]=5
}
}
if that is supposed to create a circle then it should use i-imageH and j-imageW something like