-
Notifications
You must be signed in to change notification settings - Fork 0
/
amgauss.m
50 lines (47 loc) · 1.62 KB
/
amgauss.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
function y = amgauss(N,t0,T);
%AMGAUSS Generate gaussian amplitude modulation.
% Y=AMGAUSS(N,T0,T) generates a gaussian amplitude modulation
% centered on a time T0, and with a spread proportional to T.
% This modulation is scaled such that Y(T0)=1
% and Y(T0+T/2) and Y(T0-T/2) are approximately equal to 0.5 .
%
% N : number of points.
% T0 : time center (default : N/2).
% T : time spreading (default : 2*sqrt(N)).
% Y : signal.
%
% Examples:
% z=amgauss(160); plot(z);
% z=amgauss(160,90,40); plot(z);
% z=amgauss(160,180,50); plot(z);
%
% See also AMEXPO1S, AMEXPO2S, AMRECT, AMTRIANG.
% F. Auger, July 1995.
% Copyright (c) 1996 by CNRS (France).
%
% This program is free software; you can redistribute it and/or modify
% it under the terms of the GNU General Public License as published by
% the Free Software Foundation; either version 2 of the License, or
% (at your option) any later version.
%
% This program is distributed in the hope that it will be useful,
% but WITHOUT ANY WARRANTY; without even the implied warranty of
% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
% GNU General Public License for more details.
%
% You should have received a copy of the GNU General Public License
% along with this program; if not, write to the Free Software
% Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
if (nargin == 0),
error ( 'The number of parameters must be at least 1.' );
elseif (nargin == 1),
t0=N/2; T=2*sqrt(N);
elseif (nargin ==2),
T=2*sqrt(N);
end;
if (N<=0),
error('N must be greater or equal to 1.');
else
tmt0=(1:N)'-t0;
y = exp(-(tmt0/T).^2 * pi);
end;