integral_dke_jd

PURPOSE ^

SYNOPSIS ^

function [SX] = integral_dke_jd(dx,X,d)

DESCRIPTION ^

    Numerical integration on the dimension d of the matrix X, with steps dx

    Input:

        - dx: steps [1,nx]
       - X: matrix [nd dimensions, dim d of size nx]
       - d: dimension for integration

    Output:

        - sf: integrated matrix, of dimension nd-1 

Last update: 02/05/2002

by J. Decker (12/13/02)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [SX] = integral_dke_jd(dx,X,d)
0002 %
0003 %    Numerical integration on the dimension d of the matrix X, with steps dx
0004 %
0005 %    Input:
0006 %
0007 %        - dx: steps [1,nx]
0008 %       - X: matrix [nd dimensions, dim d of size nx]
0009 %       - d: dimension for integration
0010 %
0011 %    Output:
0012 %
0013 %        - sf: integrated matrix, of dimension nd-1
0014 %
0015 %Last update: 02/05/2002
0016 %
0017 %by J. Decker (12/13/02)
0018 %
0019 if nargin < 3,
0020     error('Wrong number of input arguments for integral_dke_jd');
0021 end
0022 %
0023 nd = ndims(X);
0024 ndx = length(dx);
0025 %
0026 if size(X,d) ~= ndx
0027     error('Dimension mismatch');
0028 end 
0029 %
0030 if ndx == 0
0031     SX = [];
0032     return
0033 end
0034 if ndx == 1
0035     %SX = squeeze(X);
0036     SX = squeeze(X*dx);
0037     if size(SX,1) == 1
0038         SX = SX.';
0039     end
0040     return;
0041 end
0042 Xs = shiftdim(X,d-1);
0043 clear X
0044 dx = dx(:);
0045 %
0046 sizeXs = size(Xs);
0047 Xdxs = zeros(sizeXs);
0048 nds = ndims(Xs);
0049 if nds > 1
0050     Xdxs = repmat(dx,[1,sizeXs(2:nds)]);
0051 else
0052     Xdxs = dx;
0053 end
0054 %
0055 SXs = sum(Xdxs.*Xs);
0056 clear Xdxs Xs
0057 %
0058 if nd > 2
0059 %    SXs = squeeze(SXs);
0060 %   SX = shiftdim(SXs,nd-d);
0061     SX = shiftdim(shiftdim(SXs,1),nd-d);
0062 else
0063     SX = SXs.';
0064 end
0065

Community support and wiki are available on Redmine. Last update: 18-Apr-2019.