~ubuntu-branches/ubuntu/wily/octave-miscellaneous/wily

« back to all changes in this revision

Viewing changes to inst/laguerrepoly.m

  • Committer: Package Import Robot
  • Author(s): Sébastien Villemot, Sébastien Villemot, Rafael Laboissiere
  • Date: 2012-04-02 13:20:23 UTC
  • mfrom: (1.1.6)
  • Revision ID: package-import@ubuntu.com-20120402132023-t41xaso7sl5cex90
Tags: 1.1.0-1
[ Sébastien Villemot ]
* Imported Upstream version 1.1.0
* debian/patches/match-cell-array.patch: remove patch (applied upstream)
* debian/patches/waitbar-rename.patch: remove patch (applied upstream)
* debian/patches/no-flexml.patch: remove obsolete patch, flex no longer used
  (Closes: #666294)
* debian/copyright: reflect upstream changes
* debian/octave-miscellaneous.docs: remove, no more docs in the package
* debian/clean: remove obsolete file
* debian/rules: remove hack for wrong permissions in upstream tarball

[ Rafael Laboissiere ]
* debian/watch: Use the SourceForge redirector

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
## Copyright (C) 2007 Muthiah Annamalai <muthiah.annamalai@uta.edu>
2
 
##
3
 
## This program is free software; you can redistribute it and/or modify
4
 
## it under the terms of the GNU General Public License as published by
5
 
## the Free Software Foundation; either version 2 of the License, or
6
 
## (at your option) any later version.
7
 
##
8
 
## This program is distributed in the hope that it will be useful,
9
 
## but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
## GNU General Public License for more details.
12
 
##
13
 
## You should have received a copy of the GNU General Public License
14
 
## along with this program; if not, write to the Free Software
15
 
## Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 
1
## Copyright (C) 2007 Muthiah Annamalai <muthiah.annamalai@mavs.uta.edu>
 
2
##
 
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
 
6
## version.
 
7
##
 
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
 
11
## details.
 
12
##
 
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/>.
16
15
 
17
16
## -*- texinfo -*-
18
17
## @deftypefn {Function File} {@var{coefs}=} laguerrepoly (@var{order},@var{x})
28
27
##
29
28
## @end deftypefn
30
29
 
31
 
function h=laguerrepoly(order,val)
32
 
        if nargin < 1, error('usage: hermitepoly(order.val)'), end
33
 
        
34
 
        h_prev=[0 1];
35
 
        h_now=[-1 1];
36
 
 
37
 
        if order == 0
38
 
           h=h_prev;
39
 
        else
40
 
           h=h_now;
41
 
        end
42
 
 
43
 
        for ord=2:order
44
 
         x=[];y=[];
45
 
         if (length(h_now) < (1+ord))
46
 
           x=0;
47
 
         end;
48
 
         y=zeros(1,(1+ord)-length(h_prev));
49
 
         p1=[h_now, x];
50
 
         p2=[x, h_now];
51
 
         p3=[y, h_prev];
52
 
         h=((2*ord -1).*p2 -p1 -(ord -1).*p3)./(ord);
53
 
         h_prev=h_now;
54
 
         h_now=h;
55
 
        end
56
 
 
57
 
        if nargin == 2
58
 
         h=polyval(h,val);
59
 
        end
60
 
        
61
 
        return
62
 
end
 
30
function h = laguerrepoly (order, val)
 
31
  if (nargin < 1 || nargin > 2)
 
32
    print_usage
 
33
  endif
 
34
 
 
35
  h_prev=[0 1];
 
36
  h_now=[-1 1];
 
37
 
 
38
  if order == 0
 
39
    h=h_prev;
 
40
  else
 
41
    h=h_now;
 
42
  endif
 
43
 
 
44
  for ord=2:order
 
45
    x=[];
 
46
    y=[];
 
47
    if (length(h_now) < (1+ord))
 
48
      x=0;
 
49
    endif
 
50
    y=zeros(1,(1+ord)-length(h_prev));
 
51
    p1=[h_now, x];
 
52
    p2=[x, h_now];
 
53
    p3=[y, h_prev];
 
54
    h=((2*ord -1).*p2 -p1 -(ord -1).*p3)./(ord);
 
55
    h_prev=h_now;
 
56
    h_now=h;
 
57
  endfor
 
58
 
 
59
  if nargin == 2
 
60
    h=polyval(h,val);
 
61
  endif
 
62
 
 
63
endfunction