Home > Src > Hyperbolic_1d > simpcz.m

simpcz

PURPOSE ^

SIMPCX. Composite Simpson Quadrature Formula

SYNOPSIS ^

function [int]=simpcx(xx,yy)

DESCRIPTION ^

 SIMPCX. Composite Simpson Quadrature Formula 
 function [int]=simpc(xx,yy)


 Input:
 xx    equispaced abscissas, size(xx) has to be odd
 yy    ordinates 

 Output:
 int  computed integral 

 Autori:  pg

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [int]=simpcx(xx,yy)
0002 % SIMPCX. Composite Simpson Quadrature Formula
0003 % function [int]=simpc(xx,yy)
0004 %
0005 %
0006 % Input:
0007 % xx    equispaced abscissas, size(xx) has to be odd
0008 % yy    ordinates
0009 %
0010 % Output:
0011 % int  computed integral
0012 %
0013 % Autori:  pg
0014 h=xx(3)-xx(1);
0015 n=length(yy);
0016 int=0;
0017 m=fix(n/2);
0018 for i=1:2:n-2
0019 int=int+yy(i)+yy(i+2)+4*yy(i+1);
0020 end
0021 int=int*h/6;

Generated on Fri 21-Sep-2007 10:07:00 by m2html © 2003