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

  1. % function [dsysl,dsysr] = musynflp(pre_dsysl,Ddata,sens,blk,nmeas,ncntrl,wt)
  2. %
  3. %   Fits the magnitude curve obtained by multiplying the old D 
  4. %   frequency response (from PRE_DSYSL) with the DDATA data. 
  5. %   Returns stable, minimum phase system matrices DSYSL and 
  6. %   DSYSR, which can be absorbed into the original interconnection 
  7. %   structure with multiplications (using MMULT), and one inverse 
  8. %   (using MINV). Once absorbed, a H_infinity design can be performed,
  9. %   completing another iteration of MU-SYNTHESIS.
  10. %
  11. %   For the first MU-SYNTHESIS iteration, the variable
  12. %   PRE_DSYSL should be set to the string  'first'
  13. %   In subsequent iterations, PRE_DSYSL should be the previous
  14. %   (left) rational D-scaling system matrix, DSYSL.
  15. %
  16. %   Identical to MUSYNFIT except that FITMAGLP is called instead of
  17. %   FITMAG, and this calls MAGFIT. 
  18. %
  19. %   See also: FITMAGLP, MAGFIT, MUFTBTCH, and MUSYNFIT. 
  20.  
  21. function [dsysl,dsysr] = musynflp(osysl,magdata,sens,blk,nmeas,ncntrl,wt)
  22. if nargin < 6
  23.  disp('usage: [dsysl,dsysr] = musynflp(pre_dsysl,Ddata,sens,blk,nmeas,ncntrl)')
  24.  return
  25. end
  26. %
  27. [nblk,x] = size(blk);
  28. leftdim = nmeas;
  29.  for i=1:nblk
  30.   if blk(i,2) == 0
  31.     leftdim = leftdim + blk(i,1);
  32.     if blk(i,1) > 1
  33.       disp('full Ds not implemented yet')
  34.       return
  35.     end
  36.   else
  37.     leftdim = leftdim + blk(i,2);
  38.   end
  39.  end
  40. %
  41.  [mtype,mrows,mcols,mnum] = minfo(magdata);
  42.  omega = magdata(1:mnum,mcols+1);
  43.  [stype,srows,scols,snum] = minfo(sens);
  44.  if mnum ~= snum
  45.    error('SENS & MAG data have diff # of points - rerun VMU')
  46.    return
  47.  end
  48.  if nargin == 7
  49.    [wtype,wrows,wcols,wnum] = minfo(wt);
  50.    if wnum ~= mnum
  51.     error('WT & MAG data have diff # of points - rerun VMU')
  52.     return
  53.    end
  54.    supwt = wt(1:mnum,1);
  55.  else
  56.    supwt = ones(mnum,1);
  57.  end
  58. %
  59. %  NORMALIZE THE DATA BY THE LAST DSCALE
  60. %
  61.  magdata(1:mnum,1:mcols-1) = ...
  62.     inv(diag(magdata(1:mnum,mcols)))*magdata(1:mnum,1:mcols-1);
  63. %
  64. % MODIFICATION START %%%%%%%%%%%%%%
  65.  if isstr(osysl)
  66.    if strcmp(osysl,'first');
  67.      osysl_g = eye(leftdim);
  68.    else
  69.      error('First argument should be the string   first   or a SYSTEM matrix')
  70.      return  
  71.    end       
  72.  else        
  73.    [dum1,dum2,dum3,dum4] = minfo(osysl);
  74.    if strcmp(dum1,'syst')
  75.      osysl_g = frsp(osysl,omega);
  76.    elseif strcmp(dum1,'cons')
  77.      osysl_g = osysl;
  78.    else      
  79.      error('First argument should be the string   first   or a SYSTEM matrix')
  80.      return  
  81.    end       
  82.  end         
  83. % MODIFICATION END %%%%%%%%%%%%%%
  84.  loc = 1;
  85.  dsysl = [];
  86.  dsysr = [];
  87.  for i=1:nblk-1
  88.    wt = vpck((abs(sens(1:mnum,i) .* supwt)),omega);
  89.    osysl_g_loc = sel(osysl_g,loc,loc);
  90.    newdata = vabs(mmult(osysl_g_loc,sel(magdata,1,i)));
  91.    heading = ['FITTING D SCALING #' int2str(i)];
  92.    scalard = fitmaglp(newdata,wt,heading,osysl_g_loc);
  93.    tmpsys = [];
  94.    for j=1:min([blk(i,1) blk(i,2)])
  95.      tmpsys = daug(tmpsys,scalard);
  96.    end
  97.    dsysl = daug(dsysl,tmpsys);
  98.    dsysr = daug(dsysr,tmpsys);
  99.    if blk(i,1) < blk(i,2)
  100.      for j=1:(blk(i,2)-blk(i,1))
  101.        dsysl = daug(dsysl,scalard);
  102.      end
  103.    elseif blk(i,2) < blk(i,1)
  104.      for j=1:(blk(i,1)-blk(i,2))
  105.        dsysr = daug(dsysr,scalard);
  106.      end
  107.    end
  108.    loc = loc + blk(i,2);
  109.  end
  110.  dsysl = daug(dsysl,eye(blk(nblk,2)+nmeas));
  111.  dsysr = daug(dsysr,eye(blk(nblk,1)+ncntrl));
  112. %
  113. % Copyright MUSYN INC 1991,  All Rights Reserved
  114.