Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/sharepoint/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Matlab 如何使用Gauss-Lobatto和Gauss-Laguerre求积码_Matlab_Numerical Integration_Polynomial Approximations - Fatal编程技术网

Matlab 如何使用Gauss-Lobatto和Gauss-Laguerre求积码

Matlab 如何使用Gauss-Lobatto和Gauss-Laguerre求积码,matlab,numerical-integration,polynomial-approximations,Matlab,Numerical Integration,Polynomial Approximations,我正在使用MATLAB和以下函数: function [x,w,P]=lglnodes(N) % Truncation + 1 N1=N+1; x=cos(pi*(0:N)/N)'; % Legendre Vandermonde Matrix P=zeros(N1,N1); xold=2; while max(abs(x-xold))>eps xold=x; P(:,1)=1; P(:,2)=x; for k=2:N P(:,k

我正在使用MATLAB和以下函数:

function [x,w,P]=lglnodes(N)

% Truncation + 1
N1=N+1;

x=cos(pi*(0:N)/N)';

% Legendre Vandermonde Matrix
P=zeros(N1,N1);

xold=2;

while max(abs(x-xold))>eps

    xold=x;

    P(:,1)=1;    P(:,2)=x;

    for k=2:N
        P(:,k+1)=( (2*k-1)*x.*P(:,k)-(k-1)*P(:,k-1) )/k;
    end

    x=xold-( x.*P(:,N1)-P(:,N) )./( N1*P(:,N1) );

end

w=2./(N*N1*P(:,N1).^2);
通过这个函数,我可以得到权重和节点,通过它们我可以集成我最喜欢的函数。例如,我可以调用
lglnodes(400-1)
并获取
N=400
的节点和权重。那么我有这个代码:


我想对Gauss-Laguerre(
GaussLaguerre(n,alpha)
函数)也这样做,但我无法理解如何使用输入获得与上述相同的权重。你能给我解释一下如何调整输入吗?如何设置
n
alpha

Gauss Lobatto和Gauss Laguerre是两个不同积分的积分点/权重:

  • Lobatto表示(-1,1)中的未加权积分
  • 拉盖尔代表(0,infty),权重
    x^alpha exp(-x)
你不能期望得到同样的重量