rbmatlab  1.16.09
 All Classes Namespaces Files Functions Variables Modules Pages
demo_quadratures.m
Go to the documentation of this file.
1 function qres = demo_quadratures(pdeg,qdeg)
2 %function qres = demo_quadratures(pdeg,qdeg)
3 % small script demonstrating interval integration of polynomials
4 % of degree 'pdeg' with quadratures of degree 'qdeg'
5 %
6 % Parameters:
7 % pdeg: polynomial degree (default = 25)
8 % qdeg: quadrature degree (default = 23)
9 %
10 % Return values:
11 % qres: a matrix with the integration results
12 
13 % Bernard Haasdonk 28.8.2009
14 
15 help demo_quadratures;
16 
17 if nargin < 2
18  qdeg = 23;
19 end;
20 if nargin < 1
21  pdeg = 25;
22 end;
23 qres = zeros(pdeg+1,qdeg+1);
24 for d=0:pdeg
25  f = @(x) x.^d;
26  for q = 0:qdeg
27  qres(d+1,q+1)=intervalquadrature(q,f);
28  end;
29 end;
30 disp(qres); % otherwise in the demos command window no output appears.
function res = intervalquadrature(poldeg, func, varargin)
integration of function func over reference interval == unit interval. by Gaussian quadrature exactly...
function qres = demo_quadratures(pdeg, qdeg)
small script demonstrating interval integration of polynomials of degree pdeg with quadratures of deg...