1 ## Copyright (C) 2008 Muthiah Annamalai <muthiah.annamalai@uta.edu>
3 ## This program is free software; you can redistribute it and/or modify it under
4 ## the terms of the GNU General Public License as published by the Free Software
5 ## Foundation; either version 3 of the License, or (at your option) any later
8 ## This program is distributed in the hope that it will be useful, but WITHOUT
9 ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 ## FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
13 ## You should have received a copy of the GNU General Public License along with
14 ## this program; if not, see <http://www.gnu.org/licenses/>.
17 ## @deftypefn{Function File} {m = } fht ( d, n, dim )
18 ## @cindex linear algebra
19 ## The function fht calculates Fast Hartley Transform
20 ## where @var{d} is the real input vector (matrix), and @var{m}
21 ## is the real-transform vector. For matrices the hartley transform
22 ## is calculated along the columns by default. The options
23 ## @var{n},and @var{dim} are similar to the options of FFT function.
25 ## The forward and inverse hartley transforms are the same (except for a
26 ## scale factor of 1/N for the inverse hartley transform), but
27 ## implemented using different functions .
29 ## The definition of the forward hartley transform for vector d,
31 ## m[K] = \sum_{i=0}^{N-1} d[i]*(cos[K*2*pi*i/N] + sin[K*2*pi*i/N]), for 0 <= K < N.
32 ## m[K] = \sum_{i=0}^{N-1} d[i]*CAS[K*i], for 0 <= K < N. }
40 function m = fht( d, n, dim )
48 elseif ( nargin == 2 )
54 m = real(Y) - imag(Y);
60 # t = 2*pi*(K-1).*i/N;
61 # ker = (cos(t) + sin(t));
68 %!assert( fht([1 2 3 4]),[10 -4 -2 0] )