Code covered by the BSD License  

Highlights from
Interactive Power Spectrum Demo, Version 2

image thumbnail
from Interactive Power Spectrum Demo, Version 2 by Tom O'Haver
Interactive signal generator with power spectrum display and sound output

exp(-((x-pos)./(0.6006.*wid)) .^2);
function g = gaussian(x,pos,wid)
%  gaussian(x,pos,wid) = gaussian peak centered on pos, half-width=wid
%  x may be scalar, vector, or matrix, pos and wid both scalar
%  T. C. O'Haver, 1988
% Example: gaussian([1 2 3],1,2) gives result [0.5000    1.0000    0.5000]
g = exp(-((x-pos)./(0.6006.*wid)) .^2);

Contact us at files@mathworks.com