Code covered by the BSD License

# Electromagnetic Waves & Antennas Toolbox

### Sophocles Orfanidis (view profile)

• 1 file
• 4.43243

06 Feb 2004 (Updated )

Companion Software

```% quadrs.m - Gauss-Legendre quadrature weights and evaluation points on subintervals
%
%        [w,x] = quadrs(ab)         (equivalent to N=16)
%
% ab = integration subintervals = [a0,a1,a2,...,aM]
% N  = number of weights in quadrature formula (default N=16)
%
% w = length-N column vector of (symmetric) weights
% x = length-N column vector of shifted/scaled Legendre evaluation points
%
% notes: the desired interval [a,b]=[a0,aM] is divided into M subintervals [a0,a1,...,aM]
%        and the weights/evaluation points of each subinterval are computed by QUADR
%        and concatenated together, that is,
%
%        w = [w1; w2; ...; wM], x = [x1; x2; ..., xM]
%
%        the desired integral over [a,b] is J = w'*f(x) = w1'*f(x1) + ... + wM'*f(xM)
%
% examples: [w,x] = quadrs([1,2], 5);
%
%           the operation: [w,x] = quadrs([1,1.5,2], 5) is equivalent to:
%

% S. J. Orfanidis - 1999 - www.ece.rutgers.edu/~orfanidi/ewa

if nargin==0, help quadrs; return; end
if nargin==1, N=16; end

M = length(ab) - 1;

w = [];
x = [];

for i=1:M,