home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l455 / 2.ddi / MUTOOLS1.DI$ / TRANSP.M < prev    next >
Encoding:
Text File  |  1993-03-11  |  1.0 KB  |  44 lines

  1. % function out = transp(mat)
  2. %
  3. %   Transpose a VARYING matrix, or  dual of a SYSTEM matrix
  4. %
  5. %   See also: ', .', CJT, VTP, and VCJT.
  6.  
  7. function out = transp(mat)
  8.  if nargin ~= 1
  9.    disp('usage: out = transp(mat)')
  10.    return
  11.  end
  12.  [mtype,mrows,mcols,mnum] = minfo(mat);
  13.  if mtype == 'vary'
  14.    [nr,nc] = size(mat);
  15.    omega = mat(1:mnum,nc);
  16.    npts = mnum;
  17.    nrout = mcols;
  18.    ncout = mrows;
  19.    out = zeros(nrout*npts+1,ncout+1);
  20.    out(nrout*npts+1,ncout+1) = inf;
  21.    out(nrout*npts+1,ncout) = npts;
  22.    out(1:npts,ncout+1) = omega;
  23.  
  24.    fone = (npts+1)*mrows;
  25.    fout = (npts+1)*nrout;
  26.    pone = 1:mrows:fone;
  27.    pout = 1:nrout:fout;
  28.    ponem1 = pone(2:npts+1) - 1;
  29.    poutm1 = pout(2:npts+1) - 1; 
  30.    for i=1:npts
  31.      out(pout(i):poutm1(i),1:ncout) = ...
  32.          mat(pone(i):ponem1(i),1:mcols).';
  33.    end
  34.  elseif mtype == 'syst'
  35.    [a,b,c,d] = unpck(mat);
  36.    out = pck(a.',c.',b.',d.');
  37.  elseif mtype == 'cons'
  38.    out = mat.';
  39.  else
  40.    out = [];
  41.  end
  42. %
  43. % Copyright MUSYN INC 1991,  All Rights Reserved
  44.