trapeze_dke_jd

PURPOSE ^

SYNOPSIS ^

function [mhu] = trapeze_dke_jd(mhumin,mhumax,dmhu,dmhumax);

DESCRIPTION ^

 Generates a grid with linear increase in the steps from the edge to the center

   INPUTS:

       - mhumin : lower bound for the grid
       - mhumax : upper bound for the grid
       - dmhu : egde grid step
       - dmhumax : maximum grid step

   OUTPUTS:

       - mhu : resulting grid

 J. Decker 11/29/02

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [mhu] = trapeze_dke_jd(mhumin,mhumax,dmhu,dmhumax);
0002 %
0003 % Generates a grid with linear increase in the steps from the edge to the center
0004 %
0005 %   INPUTS:
0006 %
0007 %       - mhumin : lower bound for the grid
0008 %       - mhumax : upper bound for the grid
0009 %       - dmhu : egde grid step
0010 %       - dmhumax : maximum grid step
0011 %
0012 %   OUTPUTS:
0013 %
0014 %       - mhu : resulting grid
0015 %
0016 % J. Decker 11/29/02
0017 
0018 rfactor = dmhumax/dmhu;
0019 mhuw = (mhumax - mhumin)/2;
0020 if mhuw >= 2*dmhu & rfactor >= 2
0021     for i=1:rfactor-1
0022         mhun(i) = dmhu*((i+2)*(i+1)/2-1);
0023     end
0024     n = max(find(mhun <= mhuw));
0025     j = n;
0026     while j > 0
0027         d = 2*(mhuw - mhun(j));
0028         dmhuj = (j+1)*dmhu;
0029         dmhujp = (j+2)*dmhu;
0030         m = floor(d/dmhuj);
0031         if m > 0 & (d/m) <= dmhujp
0032             mhum = mhumin + [0 mhun(1:j-1)];
0033             mhup = mhumax - [0 mhun(1:j-1)];
0034             mhuc = linspace(mhumin + mhun(j),mhumax - mhun(j),m+1);
0035             mhu = [mhum,mhup,mhuc];
0036             break
0037         end
0038         j = j-1;
0039     end
0040 else
0041     j=0;
0042 end
0043 if j == 0
0044     d = 2*mhuw;
0045     dmhuj = dmhu;
0046     m = floor(d/dmhuj);
0047     mhu = linspace(mhumin,mhumax,m+2);
0048 end
0049 mhu = sort(mhu);
0050     
0051

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