function y = LaguerreGen(varargin)
%LaguerreGen calculates the generalized Laguerre polynomial L{n, alpha}
%
% This function computes the generalized Laguerre polynomial L{n,alpha}.
% If no alpha is supplied, alpha is set to zero and this function
% calculates the "normal" Laguerre polynomial.
%
% Input:
% - n = nonnegative integer as degree level
% - alpha >= -1 real number (input is optional)
%
% The output is formated as a polynomial vector of degree (n+1)
% corresponding to MatLab norms (that is the highest coefficient is the
% first element).
%
% Possible usage:
% - polyval(LaguerreGen(n, alpha), x) evaluates L{n, alpha}(x)
% - roots(LaguerreGen(n, alpha)) calculates roots of L{n, alpha}
% Calculation is done recursively using matrix operations for very fast
% execution time. The formula is taken from Szeg�: Orthogonal Polynomials,
% 1958, formula (5.1.10)
% Author: Matthias.Trampisch@rub.de
% Date: 16.08.2007
% Version 1.2
%% ====================================================================== %
% set default parameters and rename input
% ======================================================================= %
if (nargin == 1) %only one parameter "n" supplied
n = varargin{1};
alpha = 0; %set defaul value for alpha
elseif (nargin == 2) %at least two parameters supplied
n = varargin{1};
alpha = varargin{2};
end;
%% ====================================================================== %
% error checking of input parameters
% ======================================================================= %
if (nargin == 0) || (nargin > 2) || (n~=abs(round(n))) || (alpha<-1)
error('n must be integer, and (optional) alpha >= -1');
end;
%% ====================================================================== %
% Recursive calculation of generalized Laguerre polynomial
% ======================================================================= %
L=zeros(n+1); %reserve memory for faster storage
switch n
case 0
L(1,:)=1;
otherwise %n>1 so we need to do recursion
L(1,:)=[zeros(1,n), 1];
L(2,:)=[zeros(1, n-1), -1, (alpha+1)];
for i=3:n+1
A1 = 1/(i-1) * (conv([zeros(1, n-1), -1, (2*(i-1)+alpha-1)], L(i-1,:)));
A2 = 1/(i-1) * (conv([zeros(1, n), ((i-1)+alpha-1)], L(i-2,:)));
B1=A1(length(A1)-n:1:length(A1));
B2=A2(length(A2)-n:1:length(A2));
L(i,:)=B1-B2; % i-th row corresponds to L{i-1, alpha}
end;
end;
%% ====================================================================== %
% Define output
% ======================================================================= %
y=L(n+1,:); %last row is the gen. Laguerre polynomial L{n, alpha}
没有合适的资源?快使用搜索试试~ 我知道了~
matlab产生广义拉盖尔多项式系数
共1个文件
m:1个
5星 · 超过95%的资源 需积分: 29 73 下载量 3 浏览量
2015-07-09
19:13:20
上传
评论 1
收藏 1KB ZIP 举报
温馨提示
matlab程序,产生广义拉盖尔多项式系数,亲测可行。如果要生成多项式,需要乘上变量
资源推荐
资源详情
资源评论
收起资源包目录
LaguerreGen.zip (1个子文件)
LaguerreGen.m 3KB
共 1 条
- 1
资源评论
- xiesivan2017-03-29初学者可以看看。
- hwcdls2017-02-18挺不错的,多谢分享
xwcbigboy
- 粉丝: 8
- 资源: 5
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功