# Gaussian distribution and angle of rotation in GratingDemo.m

**URL:** <https://psychtoolbox.discourse.group/t/gaussian-distribution-and-angle-of-rotation-in-gratingdemo-m/1815>\
**Category:** Uncategorized\
**Created:** [October 29, 2006, 8:29pm UTC](https://psychtoolbox.discourse.group/t/gaussian-distribution-and-angle-of-rotation-in-gratingdemo-m/1815 "2006-10-29T20:29:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![stephenstanleybaker](https://avatars.discourse-cdn.com/v4/letter/s/958977/32.png) [@stephenstanleybaker](https://psychtoolbox.discourse.group/u/stephenstanleybaker)\
**Post date:** [October 29, 2006, 8:29pm UTC](https://psychtoolbox.discourse.group/t/gaussian-distribution-and-angle-of-rotation-in-gratingdemo-m/1815/1 "2006-10-29T20:29:52Z")

</div>

I've been looking at the GratingDemo.m file and I'm trying to   
understand some of the math behind it.  
  
The "gaussianSpaceConstant" variable is defined as  
  
= periodsCoveredByOneStandardDeviation \* pixelsPerPeriod;  
  
and later the "circularGaussianMaskMatrix" is defined as  
  
= exp(-((x.^2) + (y.^2)) / (gaussianSpaceConstant^2));  
  
Strictly speaking, should the gaussianSpaceConstant value be   
multiplied by 2 if it is related to periods per one standard   
deviation? My mathmatical ability is some what rusty so forgive me   
for simple questions.  
  
  
I was also wondering if you were intending to update the   
GratingDemo.m to draw gratings similarly to the other grating demos   
(e.g. Showtime.m), so that when you change the orientation of the   
bars you don't get a higher spatial frequency the greater the angle   
value from 0 (and you get an error at angle = 90 as tan(90) is   
infinity). I found a better way to do it in early on in the forums.  
  
Many thanks in advance.
