% method of class @signal
% function sig=genbandpassnoise(sig,varargin)
%   INPUT VALUES:
%       sig: @signal with length and samplerate 
%   RETURN VALUE:
%       sig:  @signal 
%
% (c) 2003-2008, University of Cambridge, Medical Research Council 
% Maintained by Tom Walters (tcw24@cam.ac.uk), written by Stefan Bleeck (stefan@bleeck.de)
% http://www.pdn.cam.ac.uk/cnbh/aim2006
% $Date: 2008-06-10 18:00:16 +0100 (Tue, 10 Jun 2008) $
% $Revision: 585 $

function sig=generateAMnoise(sig,fre,modgrad)

len=getlength(sig);
sr=getsr(sig);

% generate white noise:
vals=getvalues(sig);
vals=rand(size(vals)).*2-1;
sig=setvalues(sig,vals);

envelope=generatesinus(sig,fre,1,0);
envelope=(envelope+1)/2;

sig=sig*envelope;


sig=setname(sig,sprintf('AM noise Frequency %4.1f Hz',fre));

return
