Hello,

I am new to ImageJ and I do not find the explanation to the following issue. I would like to draw a “donut” with a Gaussian radial cross-section. I have written the following macro, but instead of getting the expected donut, I do get a saturated disc. Can anyone please help me spot my mistake?

```
ScreenSize=0.2; //in m
ScreenDistance=0.2; //in m
AngleIn=0.1; //in rad
Amplitude=255;
FRD=1;
ImageResolution=300; //in dpi
m2px=ImageResolution/0.0254 //from m to px
ImageSize = ScreenSize*m2px; //in px
r0=ScreenDistance*tan(AngleIn)*m2px; //in px
start = getTime();
xcenter = ImageSize/2;
ycenter = ImageSize/2;
newImage("FRD", "GRAY8", ImageSize, ImageSize, 1);
for (y=0; y<ImageSize; y++) {
for (x=0; x<ImageSize; x++) {
dx = x - xcenter;
dy = y - ycenter;
r = sqrt(dx*dx + dy*dy);
v = Amplitude * exp((-(r-r0)^2)/(2*FRD^2));
putPixel(x, y, v);
}
//if (y%250==0)
updateDisplay();
}
showStatus(round((ImageSize*ImageSize)/((getTime()-start)/1000)) + " pixels/sec");
```

Any help would be greatly appreciated!

Best regards

Mat