⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pd.m

📁 LiScNLS is a Matlab application for the numerical study of some nonlinear differential equations o
💻 M
字号:
function [x,w]=pd(n,dom)
% Nodes and weights for Gauss quadrature on the domain dom
%
% from N. L. Trefethen, Spectral Methods in Matlab, SIAM 2000
%      http://web.comlab.ox.ac.uk/oucl/work/nick.trefethen/spectral.html, gauss.m
%       
% input:   n - number of gridpoints
%          dom - working interval
% output:  x - the (Legendre) grid (n x 1)
%          w - the weights (1 x n)
beta = .5./sqrt(1-(2*(1:n-1)).^(-2));
T = diag(beta,1) + diag(beta,-1);
[V,D] = eig(T);
x = diag(D); [x,i] = sort(x);
x=x*(dom(2)-dom(1))/2+(dom(2)+dom(1))/2;
w = 2*V(1,i).^2;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -