build_tensor_yp

PURPOSE ^

SYNOPSIS ^

function [xx,yy,varargout] = build_tensor_yp(x,y,z)

DESCRIPTION ^

 Build 2-D (matrix) or 3-D (tensor) from vectors, whatever their dimensions

 INPUT
    - x: first vecteur [1,nx] or [nx,1]
    - y: first vecteur [1,ny] or [ny,1]
    - z: first vecteur [1,nz] or [nz,1] (optional)

 OUTPUT:

    - xx: matrix or tensor [nx,ny,(nz)]
    - yy: matrix or tensor [nx,ny,(nz)]
    - zz: matrix or tensor [nx,ny,(nz)] (optional)

 By Yves Peysson (CEA-DRFC, yves.peysson@cea.fr) and Joan Decker (CEA-DRFC, joan.decker@cea.fr)

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [xx,yy,varargout] = build_tensor_yp(x,y,z)
0002 %
0003 % Build 2-D (matrix) or 3-D (tensor) from vectors, whatever their dimensions
0004 %
0005 % INPUT
0006 %    - x: first vecteur [1,nx] or [nx,1]
0007 %    - y: first vecteur [1,ny] or [ny,1]
0008 %    - z: first vecteur [1,nz] or [nz,1] (optional)
0009 %
0010 % OUTPUT:
0011 %
0012 %    - xx: matrix or tensor [nx,ny,(nz)]
0013 %    - yy: matrix or tensor [nx,ny,(nz)]
0014 %    - zz: matrix or tensor [nx,ny,(nz)] (optional)
0015 %
0016 % By Yves Peysson (CEA-DRFC, yves.peysson@cea.fr) and Joan Decker (CEA-DRFC, joan.decker@cea.fr)
0017 %
0018 if nargin < 2,error('Not enough input arguments in build_tensor_yp.m !');end
0019 %
0020 xx = repmat(x(:),[1,length(y)]);
0021 yy = repmat(y(:)',[length(x),1]);
0022 %
0023 if nargin > 2,
0024     xx = repmat(xx,[1,1,length(z)]);
0025     yy = repmat(yy,[1,1,length(z)]);
0026     varargout = {shiftdim(repmat(repmat(z,[length(y),1]),[1,1,length(x)]),2)};
0027 else
0028     varargout = {};
0029 end

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